| | |
| | | label-width="80px" |
| | | > |
| | | <el-form-item label="编号" prop="number" class="form-item"> |
| | | <el-input v-model="form.number" placeholder="请输入"> </el-input> |
| | | <el-input v-model="form.number" :disabled="title=='修改'?true:false" placeholder="请输入"> </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="落丝时间" prop="finishDate" class="form-item"> |
| | | <el-date-picker |
| | | v-model="form.finishDate" |
| | | value-format="yyyy-MM-dd" |
| | | :picker-options="pickerOptions" |
| | | type="date" |
| | | placeholder="选择日期" |
| | | class="select-width" |
| | |
| | | v-model="form.market" |
| | | placeholder="请选择" |
| | | class="select-width" |
| | | @change="getGroupNumber" |
| | | > |
| | | <el-option |
| | | v-for="item in marketList" |
| | |
| | | v-model="form.name" |
| | | placeholder="请选择" |
| | | class="select-width" |
| | | @change="getGroupNumber('name')" |
| | | > |
| | | <el-option |
| | | v-for="item in nameList" |
| | |
| | | <el-form-item label="组别" prop="workshopGroup" class="form-item"> |
| | | <el-select |
| | | v-model="form.workshopGroup" |
| | | placeholder="请选择" |
| | | placeholder="请先选择车间" |
| | | no-data-text="请先选择车间" |
| | | class="select-width" |
| | | @change="getGroupNumber()" |
| | | > |
| | | <el-option |
| | | v-for="item in workshopGroupList" |
| | | :key="item.ID" |
| | | :label="item.name" |
| | | :value="item.ID" |
| | | :key="item" |
| | | :label="item" |
| | | :value="item" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | |
| | | >保存</el-button |
| | | > |
| | | <!-- </template> |
| | | </CommonSearch> --> |
| | | </CommonSearch> --> |
| | | </div> |
| | | </div> |
| | | <div class="body-two body"> |
| | |
| | | </el-table-column> |
| | | <el-table-column prop="finenessGradeye" label="野纤" width="120"> |
| | | </el-table-column> |
| | | <el-table-column prop="finenessGradebig" label="大野" show-overflow-tooltip> |
| | | <el-table-column |
| | | prop="finenessGradebig" |
| | | label="大野" |
| | | show-overflow-tooltip |
| | | > |
| | | </el-table-column> |
| | | <el-table-column prop="finenessGradeSpecial" label="特野" width="120"> |
| | | <el-table-column |
| | | prop="finenessGradeSpecial" |
| | | label="特野" |
| | | width="120" |
| | | > |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="finenessGrade" |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | // getWorkshopManageList |
| | | import { |
| | | saveRegister, |
| | | getDictList, |
| | | getWorkshopManageList, |
| | | getRegisterDetails, |
| | | getCarNumber |
| | | } from "@/api/productManage/silkRegisterForm.js"; |
| | | import { |
| | | getCheckDetails, |
| | |
| | | } from "@/api/productManage/silkInspectForm.js"; |
| | | import pageMixin from "@/components/makepager/pager/mixin/pageMixin"; |
| | | import CommonFormTableView from "@/components/makepager/CommonFormTableView"; |
| | | import { getWorkshopManageGroup } from "@/api/productManage/productRegisterForm.js"; |
| | | export default { |
| | | name: "silkRegisterAddPage", |
| | | props: {}, |
| | |
| | | computed: {}, |
| | | data() { |
| | | return { |
| | | title:'', |
| | | loading: false, |
| | | activeName: "first", |
| | | searchOptions: [], |
| | |
| | | finishDate: [ |
| | | { required: true, message: "请选择", trigger: ["change", "blur"] }, |
| | | ], |
| | | // 庄口 |
| | | market: [ |
| | | { required: true, message: "请选择", trigger: ["change", "blur"] }, |
| | | ], |
| | | // 车间 应该true |
| | | name: [ |
| | | { required: true, message: "请选择", trigger: ["change", "blur"] }, |
| | |
| | | ], |
| | | // 组别 应该true |
| | | workshopGroup: [ |
| | | { required: false, message: "请选择", trigger: ["change", "blur"] }, |
| | | { required: true, message: "请选择", trigger: ["change", "blur"] }, |
| | | ], |
| | | circleTwo: [ |
| | | { required: true, message: "请填写", trigger: ["change", "blur"] }, |
| | |
| | | position: [ |
| | | { required: true, message: "请填写", trigger: ["change", "blur"] }, |
| | | ], |
| | | }, |
| | | pickerOptions: { |
| | | disabledDate(time) { |
| | | return time.getTime() < new Date().getTime() - 86400000; |
| | | }, |
| | | }, |
| | | tableTwoList: { |
| | | tableInfomation: [], |
| | |
| | | { |
| | | label: "纤度合计", |
| | | prop: "sum", |
| | | inputNumber: true, |
| | | isRequird: true, |
| | | }, // 下次回访日期 |
| | | ], |
| | | }, |
| | | tableData: [], |
| | | tableData: [ |
| | | { |
| | | productId: 1, |
| | | position: null, |
| | | fineness: null, |
| | | quantity: null, |
| | | sum: null, |
| | | } |
| | | ], |
| | | registerId: "", |
| | | inspectID: "", |
| | | isRegisterSave: false, |
| | |
| | | this.activeName = query.activeName ? query.activeName : "first"; |
| | | this.registerId = query.id ? query.id : ""; |
| | | this.inspectID = query.inspectID ? query.inspectID : ""; |
| | | this.title= query.title ? query.title : ""; |
| | | } |
| | | this.getSelectDataList(); |
| | | this.keyword = ""; |
| | | this.getDetailsData(); |
| | | }, |
| | | methods: { |
| | | getDetailsData(id) { |
| | | async getDetailsData(id) { |
| | | if (this.activeName == "first") { |
| | | this.form = { |
| | | number: "", |
| | |
| | | position: "", |
| | | }; |
| | | if (this.registerId) { |
| | | getRegisterDetails({ id: id ? id : this.registerId }).then( |
| | | await getRegisterDetails({ id: id ? id : this.registerId }).then( |
| | | (response) => { |
| | | if (response.code === 200) { |
| | | let config = JSON.parse( |
| | | JSON.stringify(response.data ? response.data : {}) |
| | | ); |
| | | this.form = config; |
| | | this.tableList.tableData = config.finenessList |
| | | this.getGroupNumber('','edit') |
| | | let finenessList=config.finenessList |
| | | ? config.finenessList |
| | | : []; |
| | | this.tableData=this.tableList.tableData |
| | | if(finenessList.length>0){ |
| | | finenessList.map((item,index)=>{ |
| | | item.productId=index+1 |
| | | }) |
| | | } |
| | | this.tableList.tableData = finenessList |
| | | this.tableData = this.tableList.tableData; |
| | | } |
| | | } |
| | | ); |
| | |
| | | this.form.finishDate = config.finenessRegister.finishDate; |
| | | this.form.circle = config.finenessRegister.circle; |
| | | this.getTableHeader(); |
| | | let arr= response.data.items |
| | | ? response.data.items |
| | | : []; |
| | | for(let i in arr){ |
| | | let round=arr[i].finenessRoundingItems |
| | | if(arr[i].finenessGrade){ |
| | | if(arr[i].finenessGrade.indexOf('野纤')>-1){ |
| | | arr[i].finenessGradeye=arr[i].finenessGrade |
| | | }else if(arr[i].finenessGrade.indexOf('大野')>-1){ |
| | | arr[i].finenessGradebig=arr[i].finenessGrade |
| | | }else if(arr[i].finenessGrade.indexOf('特野')>-1){ |
| | | arr[i].finenessGradeSpecial=arr[i].finenessGrade |
| | | } |
| | | } |
| | | if(round){ |
| | | for(let j in round){ |
| | | arr[i][round[j].fineness]=round[j].quantity |
| | | } |
| | | } |
| | | let arr = response.data.items ? response.data.items : []; |
| | | for (let i in arr) { |
| | | let round = arr[i].finenessRoundingItems; |
| | | if (arr[i].finenessGrade) { |
| | | if (arr[i].finenessGrade.indexOf("野纤") > -1) { |
| | | arr[i].finenessGradeye = arr[i].finenessGrade; |
| | | } else if (arr[i].finenessGrade.indexOf("大野") > -1) { |
| | | arr[i].finenessGradebig = arr[i].finenessGrade; |
| | | } else if (arr[i].finenessGrade.indexOf("特野") > -1) { |
| | | arr[i].finenessGradeSpecial = arr[i].finenessGrade; |
| | | } |
| | | } |
| | | this.tableTwoList.tableInfomation =arr; |
| | | if (round) { |
| | | for (let j in round) { |
| | | arr[i][round[j].fineness] = round[j].quantity; |
| | | } |
| | | } |
| | | } |
| | | this.tableTwoList.tableInfomation = arr; |
| | | } |
| | | }); |
| | | } |
| | |
| | | } |
| | | }); |
| | | //组别 |
| | | getWorkshopManageList().then((res) => { |
| | | if (res.code == 200) { |
| | | this.workshopGroupList = res.data || []; |
| | | } |
| | | }); |
| | | // getWorkshopManageList().then((res) => { |
| | | // if (res.code == 200) { |
| | | // this.workshopGroupList = res.data || []; |
| | | // } |
| | | // }); |
| | | //庄口 |
| | | getDictList({ |
| | | dictType: 0, |
| | |
| | | this.marketList = res.data || []; |
| | | } |
| | | }); |
| | | }, |
| | | async getGroupNumber(val,type) { |
| | | if (this.form.name) { |
| | | //组别 |
| | | let number = ""; |
| | | for (let i in this.nameList) { |
| | | if (this.nameList[i].name == this.form.name) { |
| | | number = this.nameList[i].number; |
| | | break; |
| | | } |
| | | } |
| | | if(number){ |
| | | await getWorkshopManageGroup({ number: number }).then((res) => { |
| | | if (res.code == 200) { |
| | | this.workshopGroupList = []; |
| | | let workshopGroupList = res.data || {}; |
| | | this.workshopGroupList=[] |
| | | if(val=='name'){ |
| | | this.form.workshopGroup='' |
| | | } |
| | | if (Object.keys(workshopGroupList).length > 0) { |
| | | for (let i in workshopGroupList) { |
| | | this.workshopGroupList.push(workshopGroupList[i]); |
| | | } |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | if(this.form.workshopGroup&&this.form.market&&type!='edit'){ |
| | | await getCarNumber({ |
| | | workshopName:this.form.name, |
| | | marketName:this.form.market, |
| | | groupNumber:this.form.workshopGroup, |
| | | }).then((res) => { |
| | | if (res.code == 200) { |
| | | this.tableData=[] |
| | | let data = res.data?JSON.parse(JSON.stringify(res.data)) : []; |
| | | if(Object.keys(data).length>0){ |
| | | for(let i in data){ |
| | | this.tableData.push({position:data[i],productId:Number(i)+1}) |
| | | } |
| | | } |
| | | this.tableList.tableData = this.tableData |
| | | }else{ |
| | | this.tableData=[] |
| | | } |
| | | }); |
| | | } |
| | | } else { |
| | | this.workshopGroupList = []; |
| | | } |
| | | }, |
| | | inputStart() { |
| | | this.form.circleTwo = this.form.circle + "-" + this.form.totalCircle; |
| | |
| | | if (item.productId === row.productId) { |
| | | item[prop] = val; |
| | | } |
| | | if(item.fineness&&item.quantity){ |
| | | item.sum=Number(item.fineness)*Number(item.quantity).toFixed(2) |
| | | } |
| | | }); |
| | | this.tableList.tableData= this.tableData |
| | | }, |
| | | tabsClick() { |
| | | // if (tab.name === "first") { |
| | |
| | | sum: "", |
| | | }, |
| | | ]; |
| | | }else{ |
| | | this.form.measureFineness='' |
| | | this.form.twiceChange='' |
| | | this.form.cleanliness='' |
| | | this.form.purity='' |
| | | this.form.marketProcessOrderNumber='' |
| | | this.form.inspector='' |
| | | this.tableData =this.tableList.tableData |
| | | } else { |
| | | this.form.measureFineness = ""; |
| | | this.form.twiceChange = ""; |
| | | this.form.cleanliness = ""; |
| | | this.form.purity = ""; |
| | | this.form.marketProcessOrderNumber = ""; |
| | | this.form.inspector = ""; |
| | | } |
| | | }, |
| | | // 保存 |
| | |
| | | if (valid) { |
| | | let form = JSON.parse(JSON.stringify(this.form)); |
| | | // params.workshopGroup=Number(params.workshopGroup) |
| | | this.isAddloading = true; |
| | | if (this.activeName == "first") { |
| | | delete form.circleTwo; |
| | | let finenessList = JSON.parse( |
| | | JSON.stringify(this.tableList.tableData) |
| | | ); |
| | | let isContinue=false |
| | | for (let i in finenessList) { |
| | | if(!finenessList[i].position||!finenessList[i].fineness||!finenessList[i].quantity||!finenessList[i].sum){ |
| | | isContinue=true |
| | | break; |
| | | } |
| | | } |
| | | if(isContinue){ |
| | | this.$message.error('请填写完整再保存!') |
| | | return true; |
| | | } |
| | | for (let i in finenessList) { |
| | | delete finenessList[i].productId; |
| | | } |
| | | this.isAddloading = true; |
| | | let params = { |
| | | finenessList: finenessList, |
| | | ...form, |
| | |
| | | if (this.inspectID) { |
| | | params.ID = this.form.ID ? this.form.ID : Number(this.inspectID); |
| | | } |
| | | |
| | | saveRegister(params) |
| | | .then((res) => { |
| | | if (res.code == 200) { |
| | |
| | | ? this.form.ID |
| | | : Number(this.registerId); |
| | | } |
| | | this.isAddloading = true; |
| | | saveCheck(paramsTwo) |
| | | .then((res) => { |
| | | if (res.code == 200) { |
| | |
| | | message: "保存成功!", |
| | | type: "success", |
| | | }); |
| | | this.getDetailsData() |
| | | this.getDetailsData(); |
| | | } |
| | | this.isAddloading = false; |
| | | }) |
| | |
| | | } |
| | | }); |
| | | }, |
| | | // 放弃 |
| | | cancelClick() {}, |
| | | saveClick() {}, |
| | | }, |
| | | }; |
| | | </script> |