12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016 |
- <template>
- <view>
- <uni-forms ref="form" labelPosition="left" labelAlign="left" @submit="submitForm">
- <view class="uni-form-item uni-column">
- <view class="title"><text class="uni-form-item__title">入库类型</text></view>
- <view class="uni-input-wrapper ">
- <input class="uni-input-small" disabled=true v-model="intypeName" />
- <a href='javascript:;' @click='getType' class="uni-icon"><i class="fa fa-search" aria-hidden="true"></i></a>
- </view>
- </view>
- <view class="uni-form-item uni-column">
- <view class="title"><text class="uni-form-item__title">入库日期</text></view>
- <view class="uni-input-wrapper" style="justify-content: left;">
- <picker mode="date" :value="date" :start="startDate" :end="endDate" @change="bindDateChange" v-model="inDate"
- name="requisitionDate" style="width: 100%;">
- <view class="uni-input">{{date}}</view>
- </picker>
- </view>
- </view>
- <view class="uni-form-item uni-column">
- <view class="title"><text class="uni-form-item__title">材料合同</text></view>
- <view class="uni-input-wrapper" >
- <input class="uni-input-small" disabled=true v-model="contractName" />
- <a href='javascript:;' @click='getContract(projectCode)' class="uni-icon"><i class="fa fa-search" aria-hidden="true"></i></a>
- </view>
- </view>
- <view class="uni-form-item uni-column">
- <view class="title"><text class="uni-form-item__title">供应单位</text></view>
- <view class="uni-textarea">
- <input class="uni-input-small" disabled=true v-model="supplierName" />
- </view>
- </view>
- <view class="uni-form-item uni-column">
- <view class="title"><text class="uni-form-item__title">领料类型</text></view>
- <view class="uni-input-wrapper ">
- <input class="uni-input-small" disabled=true v-model="outtypeName" />
- <a href='javascript:;' @click='getOutType' class="uni-icon"><i class="fa fa-search" aria-hidden="true"></i></a>
- </view>
- </view>
- <view class="uni-form-item uni-column">
- <view class="title"><text class="uni-form-item__title">工程合同</text></view>
- <view class="uni-input-wrapper" >
- <input class="uni-input-small" disabled=true v-model="engineeringContractName" />
- <a href='javascript:;' @click='getEngineeringContract(projectCode)' class="uni-icon"><i class="fa fa-search" aria-hidden="true"></i></a>
- </view>
- </view>
- <view class="uni-form-item uni-column">
- <view class="title" style="background-color: #efefef;"><text class="uni-form-item__title">附件</text></view>
- <view class="content">
- <g-upfile ref='gUpfile' :mode="imgList" @chooseFile='chooseFile' @imgDelete='imgDelete' :control='control'
- :columnNum="columnNum" :maxCount="maxCount" :maxFileSize="20000"></g-upfile>
- </view>
- </view>
- <uni-section title="入库明细" type="line">
- <button type="default" @click="openWindow" size="mini">添加材料</button>
- </uni-section>
- <view class="uni-form-item uni-column">
- <t-table border="2" border-color="#999999" >
- <t-tr font-size="14" color="#999999" align="left">
- <t-th align="left">名称</t-th>
- <t-th align="left">入库数量</t-th>
- <t-th align="left">不合格数量</t-th>
- <t-th align="center" style="width: 50px !important;">操作</t-th>
- </t-tr>
- <t-tr font-size="12" color="#999999" align="right" v-for="(item,index) in materials" :key="index">
- <t-td align="left">{{ item.materialName }}</t-td>
- <t-td align="left"><input class="uni-input-small" type="digit" v-model="item.inQty" style="width:50px;"/></t-td>
- <t-td align="left"><input class="uni-input-small" type="digit" v-model="item.noQty" style="width:50px;"/></t-td>
- <t-td align="center" style="width: 50px !important;"><i class="fa fa-window-close" aria-hidden="true" @click="delRow(index)" style="font-size:20px;cursor: pointer;color: #999;margin-left:15px;" title="删除"></i></t-td>
- </t-tr>
- </t-table>
- </view>
- <view style="margin-bottom: 120px;">
- </view>
- <view class="uni-btn-v uni-column">
- <button type="primary" form-type="submit" style="border-radius: 15px;">编辑</button>
- </view>
- </uni-forms>
- </view>
- </template>
- <script>
-
- import {
- getSupplierNameAndType,GetEngineeringContracts
- } from "@/common/api/commonApi.js";
- import {
- Decimal
- } from 'decimal.js'; //decimal计算
- import {GetMaterials,UpdateMaterialIn,GetMaterialInByMaterialInCode,getContractAndSupplier,getGroupName,GetMaterialsForOut} from '@/common/api/MaterialInOut.js';
- import tTable from '@/components/t-table/t-table.vue';
- import tTh from '@/components/t-table/t-th.vue';
- import tTr from '@/components/t-table/t-tr.vue';
- import tTd from '@/components/t-table/t-td.vue';
-
- var sourceType = [
- ['camera'],
- ['album'],
- ['camera', 'album']
- ]
- var sizeType = [
- ['compressed'],
- ['original'],
- ['compressed', 'original']
- ]
- export default {
- components: {
- tTable,
- tTh,
- tTr,
- tTd
- },
- data() {
- return {
- intypeCode: '', //入库类型编码
- intypeName:'', //入库类型名
- inDate: this.$util.getDate({
- format: true
- }),
- contractName:'',
- contractCode:'',
- supplierName:'',
-
- contract:{}, //获取的材料合同集合数据
- userCode: this.$util.getState(this,"userCode"), //用户编号
- projectCode:this.$util.getState(this,"projectCode"),
- contractList: [], //合同
- materials:[], //材料
-
- outtypecode:'', //领料类型编码
- outtypeName:'', //领料类型名
- engineeringContractName:'', //工程合同名
- engineeringContractCode:'', //工程合同编码
- engineeringContract:{}, //工程合同数据集合
- engineeringMaterials:[], //工程材料
- engineeringError:'', //获取工程材料返回的错误信息
- materialOut:{}, //领料单主表数据
-
-
- title: 'choose/previewImage',
- imageList: [],
- sourceTypeIndex: 2,
- sourceType: ['拍照', '相册', '拍照或相册'],
- sizeTypeIndex: 2,
- sizeType: ['压缩', '原图', '压缩或原图'],
- countIndex: 5,
- count: [1, 2, 3, 4, 5],
- title1: 'picker',
- array: [],
- index: 0,
- date: this.$util.getDate({
- format: true
- }),
- startDate: this.$util.getDate('start'),
- endDate: this.$util.getDate('end'),
- control: true,
- columnNum: 3,
- imgList: [],
- urlList: [],
- maxCount: 5
- }
- },
- onLoad() {
- //console.info(page.path);
- console.info(uni.getStorageSync('storage_state'));
- //console.info(this);
- this.$util.persistLogin(this);
- //console.info(this.$store.state.user);
- },
- onUnload() {
- this.imageList = [],
- this.sourceTypeIndex = 2,
- this.sourceType = ['拍照', '相册', '拍照或相册'],
- this.sizeTypeIndex = 2,
- this.sizeType = ['压缩', '原图', '压缩或原图'],
- this.countIndex = 5;
- },
- created: function() {
- console.info('created');
- //console.info(this.intypeName);
- this.GetMaterialInByCode();
-
- },
- mounted:function(){
- console.info('mounted');
- //console.info('intype',this.intypeCode);
-
- },
- updated: function() {
- console.info('updated');
- console.info('contract',this.contract);
- //console.info('date',this.date);
- console.info(this);
- console.info('outtypeCode',this.outtypeCode);
- if(this.date){
- this.inDate=this.date;
- }
- if(this.contract){
- if(this.contract.length>0){
- this.getSupplierName(this.contract[0].supplierCode,this.contract[0].supplierTypeCode);
- }
-
- }
-
- },
- methods: {
-
- /**
- * 手动提交
- * @param {Object} form
- */
- submitForm(e) {
- console.info('submitForm');
- let _this = this;
- if(this.intypeCode==""){
- uni.showToast({
- title:'请选择入库类型',
- duration:3000,
- icon:'none'
- });
- return;
- }
- if(this.inDate==""){
- uni.showToast({
- title:'请选择入库日期',
- duration:3000,
- icon:'none'
- });
- return;
- }
- if(this.contractCode==""){
- uni.showToast({
- title:'请选择材料合同',
- duration:3000,
- icon:'none'
- });
- return;
- }
- if(!this.userCode){
- uni.showToast({
- title:'用户登录已失效,请重新登录',
- duration:3000,
- icon:'none'
- });
- return;
- }
- if(!this.contract){
- uni.showToast({
- title:'请重新选择材料合同',
- duration:3000,
- icon:'none'
- });
- return;
- }
- if (this.outtypeCode == "") {
- uni.showToast({
- title: '请选择领料类型',
- duration: 3000,
- icon: 'none'
- });
- return;
- }
- if (this.engineeringContractCode == "") {
- uni.showToast({
- title: '请选择工程合同',
- duration: 3000,
- icon: 'none'
- });
- return;
- }
- if (!this.engineeringMaterials) {
- uni.showToast({
- title: '请重新选择工程合同',
- duration: 3000,
- icon: 'none'
- });
- return;
- }
- if(this.engineeringError!=""){
- uni.showToast({
- title: _this.engineeringError,
- duration: 3000,
- icon: 'none'
- });
- return;
- }
- var materialIn = {
- materialInCode:_this.$util.getQuery("id"),
- materialInID:_this.$util.getQuery("id"),
- projectCode: this.$store.state.projectCode,
- groupCode: this.intypeCode,
- inDate:this.inDate,
- inPerson: this.userCode,
- inputPerson: this.userCode,
- contractCode: this.contractCode,
- supplierCode: this.contract[0].supplierCode,
- supplierTypeCode: this.contract[0].supplierTypeCode,
- supplierTypeId: this.contract[0].supplierTypeId
- };
- console.info("领料类型",this.outtypeCode);
- if(!this.outtypeCode){
- uni.showToast({
- title: '领料类型获取失败,请重新获取',
- duration: 3000,
- icon: 'none'
- });
- return;
- }
- //材料领料单主表
- var materialOut = {
- materialOutCode:_this.materialOut.materialOutCode,
- materialOutID:_this.materialOut.materialOutID,
- projectCode: _this.projectCode,
- groupCode: _this.outtypeCode,
- outDate: _this.inDate,
- outPerson: _this.userCode,
- inputPerson: _this.userCode,
- contractCode: _this.engineeringContractCode,
- doSupplierCode: _this.engineeringContract[0].supplierCode,
- supplierTypeCode: _this.engineeringContract[0].supplierTypeCode,
- supplierTypeId: _this.engineeringContract[0].supplierTypeId
- };
- console.info('materials',_this.materials);
- var list1 = this.materials;
- console.info('list1',list1);
- let list = [];
- let isLessThan=true;
- list1.forEach(function(item, index, array) {
- if(item.inQty<=0){
- console.info('入库数量不能小于0');
- isLessThan=false;
- return;
- }
- list.push({
- materialCode: item.materialCode,
- unit: item.unit,
- inQty: new Decimal(item.inQty).toFixed(2) - 0,
- inPrice: new Decimal(item.standardPrice).toFixed(2) - 0,
- noPassQty:new Decimal(item.noQty).toFixed(2) - 0,
- });
- //list.push({requisitionCode:'',contractCode:item.contractCode,estimateCash: 220});
- });
- if(!isLessThan){
- uni.showToast({
- title:'入库数量不能小于0',
- duration:3000,
- icon:'none'
- });
- return;
- }
- console.info("【list】",list);
- if (list.length <= 0) {
- uni.showToast({
- title: "请添加材料",
- icon: "none",
- duration: 3000
- });
- return;
- }
- let enginList=this.engineeringMaterials;
- if(enginList.length<=0){
- uni.showToast({
- title: '请重新选择工程合同',
- duration: 3000,
- icon: 'none'
- });
- return;
- }
- console.info("材料",list1);
- console.info('工程材料',enginList);
- if(list1.length!=enginList.length){
- uni.showToast({
- title: '添加的材料与工程合同中的材料不匹配',
- duration: 3000,
- icon: 'none'
- });
- return;
- }
- let clist1=[]; //添加的材料列表
- let mlist1=[]; //工程合同中材料列表
- list1.forEach(function(item,index,arr){
- clist1.push(item.materialCode);
- });
- enginList.forEach(function(item,index,arr){
- mlist1.push({materialCode:item.materialCode,materialName:item.materialName});
- });
- console.info('添加的材料列表',clist1);
- console.info('工程合同中材料列表',mlist1);
- let noMaterials=[];
- mlist1.forEach(function(item,index,arr){
- if(clist1.indexOf(item.materialCode)==-1){
- noMaterials.push(item.materialName);
- return;
- }
- });
- if(noMaterials.length>0){
- uni.showToast({
- title: noMaterials.join(),
- duration: 3000,
- icon: 'none'
- });
- return;
- }
- //return;
- var data = {
- materialIn: materialIn,
- materialOut:materialOut,
- mDetailList: list
- };
- console.info('data',data);
- //return;
-
- //var strList=JSON.stringify(list);
- //var strData=JSON.stringify(data);
- UpdateMaterialIn(data).then((res) => {
- console.info("submitform应答返回值",res);
- if(res=="-1"){
- uni.showToast({
- title: '修改项不存在',
- icon: 'none',
- duration: 3000
- });
- return;
- }
- else if(res=="-2"){
- uni.showToast({
- title: '非待审核状态,不能修改',
- icon: 'none',
- duration: 3000
- });
- return;
- }
-
-
- if (res) {
- //上传图片
- _this.uploadFileToServe(res);
- uni.navigateTo({
- url: '/pages/template/GetMaterialIns/GetMaterialIns'
- })
- } else {
- uni.showToast({
- title: '修改失败,重新操作',
- icon: 'none',
- duration: 3000
- })
- }
- });
- },
- bindPickerChange: function(e) {
- //console.log('picker发送选择改变,携带值为:' + e.detail.value);
- //console.info(e.detail);
- this.index = e.detail.value;
- this.changeType = this.array[this.index];
- console.info(this.changeType);
- },
- bindDateChange: function(e) {
- this.date = e.detail.value;
- this.requisitionDate = this.date;
- console.info(this.date);
- },
- GetDropDown: function() {
- let that = this;
- GetQianzhengDropDown().then((res) => {
- console.info(res);
- res.forEach(function(item, index, array) {
- that.$set(that.array, index, item);
- });
- that.changeType = that.array[0];
- });
- },
-
- openWindow: function() {
- let _this = this;
- //console.info('监听事件外部this');
- //console.info(this);
- _this.saveTemp(_this);
- if(_this.contractCode==undefined||_this.contractCode==''){
- uni.showToast({
- title:'请选择材料合同',
- icon:'none',
- duration:3000
- });
- return;
- }
- //创建名字为fire的监听器,监听子页面传值事件
- uni.$on('materials', function(data) {
- console.info("监听materials子页面的传值",data);
- //从子页面返回父页面,原来表单已经填写的值会丢失,因此需要重新赋值
- _this.getTemp(_this);
- _this.materials = [];
- data.forEach(function(item, index, array) {
- //console.info("foreach");
- _this.$set(_this.materials, index, item);
- });
- //接收一次监听,一旦监听到回传值,则清除监听事件,若不清除,会占用资源
- uni.$off("materials");
- console.info("监听materials子页面的传值结束");
- });
- //打开子页面
- uni.navigateTo({
- url: "/pages/template/selectmaterials/selectmaterials?contractCode="+_this.contractCode
- })
- },
- delRow: function(index) {
- console.info("删除");
- console.info(this.materials[index]);
- this.materials.splice(index, 1);
- },
- /*
- 上传后返回的值:
- list:上传后图片数组
- v:返回当前上传图片的临时路径
- */
- chooseFile(list, v) {
- console.log("上传图片_list:", list)
- console.log("上传图片_v:", v);
- this.urlList = list;
- console.info("urlList", this.urlList);
- },
- /*
- 删除图片:
- list:删除返回删除后剩余的图片数组
- eq:返回删除的数组
- */
- imgDelete(list, eq) {
- console.log("删除图片_list:", list);
- console.log("删除图片_eq:", eq);
- this.urlList = list;
- console.info("urlList", this.urlList);
- },
- /*
- 执行上传服务:
- urlList:要上传的图片:数组类型
- */
- uploadFileToServe(masterCode) {
- let _this = this;
- var urlList = _this.urlList;
- if (!urlList || urlList.length <= 0) {
- return;
- };
- //console.info(urlList);
- //return;
- for (let i = 0; i < urlList.length; i++) {
- uni.uploadFile({
- url: '/api/Common/UploadImage',
- filePath: urlList[i],
- name: 'file',
- formData: {
- createPerson: _this.$util.getState(_this,'userCode'),
- masterCode: masterCode,
- attachMentType:'MaterialIn'
- },
- headers: {
- 'Content-Type': 'multipart/form-data; boundary = ' + new Date().getTime()
- //这里要把content-type设置为multipard/form-data,同时还要设置boundary
- },
- success: (uploadFileRes) => {
- console.log("附件上传:", uploadFileRes.data);
- }
- });
- }
- },
- /*
- 获取入库类型
- */
- getType() {
- let _this = this;
- console.info('gettype',_this);
- _this.saveTemp(_this);
- //创建名字为fire的监听器,监听子页面传值事件
- uni.$on('intype', function(data) {
- console.info("监听intype子页面的传值", data);
- console.info('监听',_this);
- _this.getTemp(_this);
- _this.intypeCode=data[0].id;
- _this.intypeName=data[0].name;
- _this.$nextTick(function(){
- //更新dom
- });
- console.info(data[0].id,data[0].name);
- console.info(_this.intypeCode,_this.intypeName);
- //接收一次监听,一旦监听到回传值,则清除监听事件,若不清除,会占用资源
- uni.$off("intype");
- });
- uni.navigateTo({
- url: '/pages/tree/tree?classCode=1503'
- });
- },
- /*
- 获取领料类型
- */
- getOutType() {
- let _this = this;
- console.info('gettype',_this);
- _this.saveTemp(_this);
- //创建名字为fire的监听器,监听子页面传值事件
- uni.$on('outtype', function(data) {
- console.info("监听outtype子页面的传值", data);
- console.info('监听',_this);
- _this.getTemp(_this);
- _this.outtypeCode=data[0].id;
- _this.outtypeName=data[0].name;
- _this.$nextTick(function(){
- //更新dom
- });
- console.info(data[0].id,data[0].name);
- console.info(_this.outtypeCode,_this.outtypeName);
- //接收一次监听,一旦监听到回传值,则清除监听事件,若不清除,会占用资源
- uni.$off("outtype");
- });
- uni.navigateTo({
- url: '/pages/treeout/treeout?classCode=1505'
- });
- },
- /*获取材料合同*/
- getContract(projectCode){
- console.info('getContract',projectCode);
- let _this = this;
- _this.saveTemp(_this); //表单存入缓存
- //创建名字为fire的监听器,监听子页面传值事件
- uni.$on('contract', function(data) {
- console.info("监听contract子页面的传值", data);
- _this.getTemp(_this); //自缓存中取出表单数据,重新赋值
- _this.contractCode=data[0].contractCode;
- _this.contractName=data[0].contractName;
- _this.contract=data;
- console.info('_this.contract',_this.contract);
- //接收一次监听,一旦监听到回传值,则清除监听事件,若不清除,会占用资源
- uni.$off("contract");
- });
- uni.navigateTo({
- url: '/pages/template/SelectContract/SelectContract?projectCode='+projectCode
- });
- },
- /*获取工程合同*/
- getEngineeringContract(projectCode){
- console.info('getEngineeringContract',projectCode);
- let _this = this;
- _this.saveTemp(_this); //表单存入缓存
- //创建名字为fire的监听器,监听子页面传值事件
- uni.$on('engineeringContract', function(data) {
- console.info("监听工程合同子页面开始");
- console.info("监听engineeringContract子页面的传值", data);
- _this.getTemp(_this); //自缓存中取出表单数据,重新赋值
- _this.engineeringContractCode=data[0].contractCode;
- _this.engineeringContractName=data[0].contractName;
- _this.engineeringContract=data;
- console.info('engineeringContract',_this.engineeringContract);
- //获取工程材料列表
- GetMaterialsForOut(_this.$util.getState(_this,'projectCode'),data[0].contractCode).then(res=>{
- if(typeof res=='string'){
- _this.engineeringError=res;
- console.info('engineeringError',_this.engineeringError);
- return;
- }
- if(res.length>0){
- res.forEach(function(item,index,arr){
- //给工程材料集合赋值
- _this.$set(_this.engineeringMaterials, index, item);
- });
- console.info('engineeringMaterials',_this.engineeringMaterials);
- }
- });
- console.info("监听工程合同子页面结束");
- //接收一次监听,一旦监听到回传值,则清除监听事件,若不清除,会占用资源
- uni.$off("engineeringContract");
- });
- uni.navigateTo({
- url: '/pages/template/SelectEgineeringContract/SelectEgineeringContract?projectCode='+projectCode
- });
- },
- /* 获取供应商名称 */
- getSupplierName(supplierCode, supplierTypeCode){
- console.info('getSupplierName');
- console.info('supplierCode',supplierCode);
- console.info('supplierTypeCode',supplierTypeCode);
- let that=this;
- if(supplierCode&&supplierTypeCode){
- getSupplierNameAndType(supplierCode, supplierTypeCode).then(res=>{
- console.info('getSupplierNameAndType',res);
- that.supplierName=res;
- });
- }
-
- },
- saveTemp(_this){ //临时存
- uni.setStorage({
- key:'intypeName',
- data:_this.intypeName
- });
- uni.setStorage({
- key:'intypeCode',
- data:_this.intypeCode
- });
- uni.setStorage({
- key:'inDate',
- data:_this.inDate
- });
- uni.setStorage({
- key:'contractCode',
- data:_this.contractCode
- });
- uni.setStorage({
- key:'contractName',
- data:_this.contractName
- });
- uni.setStorage({
- key:'supplierCode',
- data:_this.supplierCode
- });
- uni.setStorage({
- key:'supplierName',
- data:_this.supplierName
- });
- uni.setStorage({
- key:'contract',
- data:_this.contract
- });
- uni.setStorage({
- key:'usercode',
- data:_this.usercode
- });
- uni.setStorage({
- key:'imageList',
- data:_this.imageList
- });
- uni.setStorage({
- key:'engineeringContractCode',
- data:_this.engineeringContractCode
- });
- uni.setStorage({
- key:'engineeringContractName',
- data:_this.engineeringContractName
- });
- uni.setStorage({
- key:'engineeringError',
- data:_this.engineeringError
- });
- uni.setStorage({
- key:'engineeringMaterials',
- data:_this.engineeringMaterials
- });
- uni.setStorage({
- key:'outtypeName',
- data:_this.outtypeName
- });
- uni.setStorage({
- key:'outtypeCode',
- data:_this.outtypeCode
- });
- },
- getTemp(_this){ //获取缓存,重新给表单赋值
- _this.intypeCode=uni.getStorageSync('intypeCode');
- _this.intypeName=uni.getStorageSync('intypeName');
- _this.inDate=uni.getStorageSync('inDate');
- _this.contractCode=uni.getStorageSync('contractCode');
- _this.contractName=uni.getStorageSync('contractName');
- _this.supplierCode=uni.getStorageSync('supplierCode');
- _this.supplierName=uni.getStorageSync('supplierName');
- _this.supplierCode=uni.getStorageSync('supplierCode');
- _this.usercode=uni.getStorageSync('usercode');
- _this.contract=uni.getStorageSync('contract');
-
- _this.engineeringContractCode=uni.getStorageSync('engineeringContractCode');
- _this.engineeringContractName=uni.getStorageSync('engineeringContractName');
- _this.engineeringError=uni.getStorageSync('engineeringError');
- _this.engineeringMaterials=uni.getStorageSync('engineeringMaterials');
-
- _this.outtypeCode=uni.getStorageSync('outtypeCode');
- _this.outtypeName=uni.getStorageSync('outtypeName');
- },
-
- GetMaterialInByCode(){
- console.info("GetMaterialInByCode",this);
- let _this=this;
- let id=this.$util.getQuery("id");
- GetMaterialInByMaterialInCode(id).then(res=>{
- console.info('GetMaterialInByMaterialInCode',res);
- let mainEntity=res.mainEntity;
- let materialOut=res.materialOut;
- let subList=res.subList;
-
- _this.materialOut=materialOut;
- console.info('projectCode',_this.projectCode);
- if(mainEntity.projectCode!=_this.projectCode){
- uni.showModal({
- title: '提示',
- content: '非本人,无编辑权限',
- success: function (res) {
- if (res.confirm||res.cancel) {
- uni.navigateTo({
- url:'../GetMaterialIns/GetMaterialIns'
- })
- }
- }
- });
- }
- //初始化赋值
- _this.intypeCode=mainEntity.groupCode;
- _this.date=mainEntity.inDate.substring(0,10);
- _this.contractCode=mainEntity.contractCode;
-
- getContractAndSupplier(mainEntity.contractCode).then(res=>{
- console.info('getContractAndSupplier',res);
- _this.contractCode=res[0].contractCode;
- _this.contractName=res[0].contractName;
- console.info('res.contractName',res[0].contractName);
- console.info('_this.contractName',_this.contractName);
- _this.contract=res;
- });
- getGroupName(mainEntity.groupCode).then(res=>{
- console.info('getGroupName',res);
- _this.intypeName=res;
- });
- //领料类型获取
- _this.outtypeCode=materialOut.groupCode;
- console.info("_this.outtypecode",_this.outtypeCode);
- getGroupName(materialOut.groupCode).then(res=>{
- console.info('getGroupName',res);
- _this.outtypeName=res;
- });
-
- //工程合同
- _this.engineeringContractCode=materialOut.contractCode;
- getContractAndSupplier(materialOut.contractCode).then(res=>{
- console.info('工程合同',res);
-
- _this.engineeringContractName=res[0].contractName;
- console.info('res.engineeringContractName',res[0].contractName);
-
- _this.engineeringContract=res;
- //获取工程材料列表
- GetMaterialsForOut(_this.$util.getState(_this,'projectCode'),materialOut.contractCode).then(res=>{
- if(typeof res=='string'){
- _this.engineeringError=res;
- console.info('engineeringError',_this.engineeringError);
- return;
- }
- if(res.length>0){
- res.forEach(function(item,index,arr){
- //给工程材料集合赋值
- _this.$set(_this.engineeringMaterials, index, item);
- });
- console.info('engineeringMaterials',_this.engineeringMaterials);
- }
- });
- });
-
- subList.forEach(function(item, index, array) {
- //console.info("foreach");
- _this.$set(_this.materials, index, item);
- });
- });
- },
-
- }
- }
- </script>
- <style scoped>
- /* 头条小程序组件内不能引入字体 */
- /* #ifdef MP-TOUTIAO */
- @font-face {
- font-family: uniicons;
- font-weight: normal;
- font-style: normal;
- src: url("~@/static/uni.ttf") format("truetype");
- }
- /* #endif */
- page {
- display: flex;
- flex-direction: column;
- box-sizing: border-box;
- background-color: #efeff4;
- min-height: 100%;
- height: auto;
- }
- view {
- font-size: 14px;
- line-height: inherit;
- }
- .uni-form-item__title {
- font-size: 16px;
- line-height: 24px;
- }
- .uni-input-wrapper {
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- padding: 8px 13px;
- flex-direction: row;
- flex-wrap: nowrap;
- background-color: #FFFFFF;
- }
- .title {
- background-color: #efefef;
- padding: 5px 20px;
- }
- .uni-input {
- height: 28px;
- line-height: 28px;
- font-size: 15px;
- padding: 5px;
- flex: 1;
- background-color: #FFFFFF;
- }
- .uni-input-small {
- height: 28px;
- line-height: 28px;
- font-size: 15px;
- padding: 5px;
- flex: 1;
- width: 270px;
- background-color: #FFFFFF;
- }
- .uni-icon {
- height: 28px;
- line-height: 28px;
- font-size: 20px;
- padding-right: 15px;
- color: #5555ff;
- width: 50px;
- }
- .uni-eye-active {
- color: #007AFF;
- }
- .uni-btn-v {
- position: fixed;
- bottom: 0;
- width: 100%;
- }
- .header-slot-box {
- font-size: 15px;
- margin: 5px 5px;
- width: 20%;
- justify-content: center;
- }
- .body-slot-box {
- font-size: 15px;
- margin: 5px 5px;
- width: 40%;
- justify-content: center;
- }
- .footer-slot-box {
- font-size: 15px;
- margin: 5px 5px;
- width: 40%;
- justify-content: center;
- }
- .uni-textarea textarea {
- font-size: 15px;
- }
- .content {
- padding: 40rpx;
- background-color: #fff;
- }
- /* 上传控件 */
- .uploadControl {
- border: 1rpx solid #eee;
- border-radius: 10rpx;
- width: 130rpx;
- display: block;
- height: 130rpx;
- text-align: center;
- line-height: 130rpx;
- font-size: 30rpx;
- color: #888;
- background-color: #eeeeee;
- }
- .bg1 {
- background-color: #EFEFEF;
- }
- </style>
|