| | |
| | | |
| | | <template> |
| | | <div class="ins_order_add"> |
| | | <div v-show="!configShow"> |
| | | <div v-show="!configShow&&!equipConfigShow"> |
| | | <el-row class="title"> |
| | | <el-col :span="6" style="padding-left: 20px;">委托单信息</el-col> |
| | | <el-col :span="6" style="padding-left: 20px;">委托单信息 总价:<span style="color: #3A7BFA">¥{{total}}</span></el-col> |
| | | <el-col :span="18" style="text-align: right;"> |
| | | <el-select v-model="template" size="medium" placeholder="下单模板" style="margin-right: 10px;" v-show="active==1" |
| | | @change="selectInsOrderTemplateById"> |
| | |
| | | <el-button size="medium" @click="templateDia=true" v-show="active==1"> |
| | | <span style="color: #3A7BFA;">保存模板</span> |
| | | </el-button> |
| | | <el-button size="medium" type="primary" @click="openConfig">光纤配置</el-button> |
| | | <el-button size="medium" type="primary" @click="openEquipConfig" |
| | | v-if="PROJECT==='装备电缆'">电缆配置</el-button> |
| | | <el-button size="medium" type="primary" @click="openConfig" |
| | | v-if="addObj.sampleType==='光缆'">光纤配置</el-button> |
| | | <el-button size="medium" type="primary" @click="save" :loading="saveLoad" v-show="active==1">提交</el-button> |
| | | <!-- 审核 --> |
| | | <el-button size="medium" @click="upInsOrderOfState(2)" :loading="saveLoad" v-show="active==3" |
| | |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | <div class="search" v-show="!configShow"> |
| | | <div class="search" v-show="!configShow&&!equipConfigShow"> |
| | | <el-row> |
| | | <el-col class="search_thing" :span="6"> |
| | | <div class="search_label">委托编号:</div> |
| | |
| | | </div> |
| | | </el-col> |
| | | <el-col class="search_thing" :span="6"> |
| | | <div class="search_label"><span class="required-span">* </span>委托客户:</div> |
| | | <div class="search_label"><span class="required-span">* </span>委托人:</div> |
| | | <div class="search_input"> |
| | | <el-input readonly size="small" v-model="addObj.custom"> |
| | | <template slot="append"><el-button slot="append" icon="el-icon-search" @click="selectUserDia = true" |
| | |
| | | <el-col class="search_thing" :span="6"> |
| | | <div class="search_label"><span class="required-span">* </span>委托单位:</div> |
| | | <div class="search_input"> |
| | | <el-input size="small" placeholder="选择委托客户" clearable disabled v-model="addObj.company"></el-input> |
| | | <el-input size="small" placeholder="←选择委托客户" clearable disabled v-model="addObj.company"></el-input> |
| | | </div> |
| | | </el-col> |
| | | <el-col class="search_thing" :span="6"> |
| | |
| | | </el-input> |
| | | </div> |
| | | </el-col> |
| | | <el-col class="search_thing" :span="6"> |
| | | <!-- <el-col class="search_thing" :span="6"> |
| | | <div class="search_label"><span class="required-span">* </span>样品类型:</div> |
| | | <div class="search_input"> |
| | | <el-input size="small" clearable disabled v-model="addObj.sampleType"></el-input> |
| | | </div> |
| | | </el-col> |
| | | </el-col> --> |
| | | <el-col class="search_thing" :span="6"> |
| | | <div class="search_label"><span class="required-span">* </span>样品数量:</div> |
| | | <div class="search_input"> |
| | |
| | | v-model="addObj.remark" :readonly="active>1"></el-input> |
| | | </div> |
| | | </el-col> |
| | | <el-col class="search_thing" :span="6" v-if="active==1"> |
| | | <div class="search_label">RTS:</div> |
| | | <div class="search_input"> |
| | | <el-input size="small" placeholder="请输入" clearable v-model="RTS"></el-input> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | <div v-show="!configShow"> |
| | | <div v-show="!configShow&&!equipConfigShow"> |
| | | <el-table class="el-table sampleTable" ref="sampleTable" :data="sampleList" height="250px" tooltip-effect="dark" |
| | | border @selection-change="selectSample" highlight-current-row @row-click="rowClick" style="margin-top: 10px;"> |
| | | <el-table-column type="selection" width="60" :selectable="selectable" v-if="active==1"></el-table-column> |
| | |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | <!-- <el-table-column prop="unit" label="单位" align="center" min-width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-select v-model="scope.row.unit" clearable size="small" style="width: 100%;" :disabled="active>1"> |
| | | <el-option v-for="(a, i) in units" :key="i" :label="a.label" :value="a.value"></el-option> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> --> |
| | | <!-- <el-table-column prop="isLeave" label="是否留样" align="center" min-width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-select v-model="scope.row.isLeave" size="small" :disabled="active>1"> |
| | | <el-option label="留样" :value="1"></el-option> |
| | | <el-option label="不留样" :value="0"></el-option> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> --> |
| | | <el-table-column prop="joinName" label="配套样品名称" width="140" align="center" v-if="addObj.mating==1"> |
| | | <template slot-scope="scope"> |
| | | <el-input size="small" type="textarea" :autosize="{ minRows: 1, maxRows: 1}" |
| | |
| | | <el-table-column prop="inspectionItem" label="检验项" min-width="140" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="inspectionItemSubclass" label="检验项子项" min-width="140" |
| | | show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="sonLaboratory" label="子实验室" width="130" show-overflow-tooltip :filters="filters" |
| | | <el-table-column prop="sonLaboratory" label="子实验室" min-width="130" show-overflow-tooltip :filters="filters" |
| | | :filter-method="filterHandler"></el-table-column> |
| | | <el-table-column prop="methodS" label="试验方法" min-width="120" show-overflow-tooltip> |
| | | </el-table-column> |
| | | <el-table-column prop="unit" label="计量单位" width="100" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="price" label="单价" width="100" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="manDay" label="预计时间(天)" width="120" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="manHour" label="工时系数" width="100" show-overflow-tooltip></el-table-column> |
| | | <!-- <el-table-column prop="manDay" label="预计时间(天)" width="120" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="manHour" label="工时系数" width="100" show-overflow-tooltip></el-table-column> --> |
| | | <!-- <el-table-column prop="deviceGroup" label="设备组" width="120" show-overflow-tooltip></el-table-column> --> |
| | | <el-table-column prop="section" label="区间" width="120" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="section" label="区间" min-width="120" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="ask" label="要求值" min-width="220px"> |
| | | <template slot-scope="scope"> |
| | | <el-input size="small" placeholder="要求值" v-model="scope.row.ask" clearable type="textarea" |
| | |
| | | </span> |
| | | </el-dialog> |
| | | <el-dialog title="选择样品" :visible.sync="selectStandardTree" width="400px"> |
| | | <div class="body" style="height: 60vh;overflow-y: auto;" v-if="selectStandardTree"> |
| | | <div class="body" style="height: 60vh;overflow-y: auto;user-select: none;" v-if="selectStandardTree"> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-input placeholder="输入关键字进行搜索" suffix-icon="el-icon-search" v-model="search" size="small" |
| | |
| | | </el-row> |
| | | <el-tree :data="list" ref="tree" :props="{ children: 'children', label: 'label' }" node-key="label" |
| | | :filter-node-method="filterNode" @node-click="handleNodeClick" highlight-current @node-expand="nodeOpen" |
| | | @node-collapse="nodeClose" :default-expanded-keys="expandedKeys"> |
| | | @node-collapse="nodeClose" :default-expanded-keys="expandedKeys" @dblclick.native="activeStandardTree"> |
| | | <div class="custom-tree-node" slot-scope="{ node, data }"> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | |
| | | </el-row> |
| | | </span> |
| | | </el-dialog> |
| | | <fiberOpticConfig :currentId="currentId" v-if="configShow" :active="active" /> |
| | | <fiberOpticConfig :currentId="currentId" |
| | | @saveFiberopticConfig="getTotal()" |
| | | v-if="configShow" :active="active" /> |
| | | <equipConfig :currentId="currentId" |
| | | v-if="equipConfigShow" :active="active"/> |
| | | <el-dialog title="检测到特殊项,请作出以下选择" :visible.sync="bsm1Dia" width="500px" :show-close="false" :before-close="beforeClose"> |
| | | <div class="body" style="max-height: 60vh;"> |
| | | <el-row v-if="bsm1"> |
| | | <el-col class="search_thing" :span="22"> |
| | | <div class="search_label"><span class="required-span">* </span>护套密度:</div> |
| | | <div class="search_input"> |
| | | <el-radio-group v-model="bsm1Val" @input="upBsm1"> |
| | | <el-radio v-for="(a, ai) in JSON.parse(bsmRow.section)" :key="ai" :label="a"></el-radio> |
| | | </el-radio-group> |
| | | </div> |
| | | </el-col> |
| | | <el-col class="search_thing" :span="22"> |
| | | <div class="search_label">要求值:</div> |
| | | <div class="search_input" v-show="bsm1Val!==null&&bsm1Val!==''"> |
| | | <el-radio-group v-model="bsm1Val" @input="upBsm1"> |
| | | <el-radio v-for="(a, ai) in JSON.parse(bsmRow.section)" :key="ai" :label="a">{{JSON.parse(bsmRow.ask)[ai]}}</el-radio> |
| | | </el-radio-group> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import ValueTable from '../../tool/value-table.vue' |
| | | import fiberOpticConfig from './fiberoptic-config.vue' |
| | | import equipConfig from './equip-config.vue' |
| | | export default { |
| | | components: { |
| | | ValueTable, |
| | | fiberOpticConfig |
| | | fiberOpticConfig, |
| | | equipConfig |
| | | }, |
| | | props: { |
| | | active: { |
| | |
| | | configShow: false, |
| | | currentMethod: null, |
| | | isAskOnlyRead: false, |
| | | sampleId: null |
| | | sampleId: null, |
| | | bsmRow: null, |
| | | bsm1: false, |
| | | bsm1Val: null, |
| | | bsm1Dia: false, |
| | | total:0, |
| | | RTS:'', |
| | | totalArr:[], |
| | | equipConfigShow: false, |
| | | } |
| | | }, |
| | | watch: { |
| | | sampleList() { |
| | | this.addObj.method = null |
| | | this.productList = [] |
| | | }, |
| | | productList:{ |
| | | deep:true, |
| | | handler(val){ |
| | | if(val&&val.length>0){ |
| | | let arr = []; |
| | | val.forEach(item => { |
| | | if(item.sonLaboratory&&!arr.find(a=>a.value==item.sonLaboratory)){ |
| | | arr.push({ |
| | | text: item.sonLaboratory, |
| | | value: item.sonLaboratory |
| | | }) |
| | | } |
| | | }) |
| | | this.filters = arr |
| | | } |
| | | } |
| | | }, |
| | | sampleList:{ |
| | | deep:true, |
| | | handler(val){ |
| | | this.getTotal() |
| | | } |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | this.selectEnumByCategoryForUnit() |
| | | this.selectStandardMethods() |
| | | this.selectEnumByCategoryForOrderType() |
| | | this.selectEnumByCategoryForSonLaboratory() |
| | | // this.selectEnumByCategoryForSonLaboratory() |
| | | this.selectEnumByCategoryForSampleForm() |
| | | if (this.active != 1) { |
| | | // 查看/审核流程 |
| | |
| | | this.addObj.companyId = selects.id |
| | | this.selectUserDia = false |
| | | }, |
| | | handleAsk(ask){ |
| | | let code = [">","<","=",">","<","≥","≤","±"]; |
| | | if(ask.includes('RTS')){ |
| | | if(ask.includes('&')){ |
| | | // 多个条件 |
| | | let arr0 = ask.split('&') |
| | | let arr1 = [] |
| | | arr0.forEach(m=>{ |
| | | let index = code.findIndex(b=>m.includes(b)) |
| | | if(index>-1){ |
| | | let arr = m.split(code[index]).filter(b=>!!b) |
| | | let num = eval(this.replaceAll(arr[0],'RTS', this.RTS)) |
| | | m = code[index] + ''+ num |
| | | arr1.push(m) |
| | | } |
| | | }) |
| | | return arr1.join('&') |
| | | }else{ |
| | | // 单个条件 |
| | | let index = code.findIndex(b=>ask.includes(b)) |
| | | if(index>-1){ |
| | | let arr = ask.split(code[index]).filter(b=>!!b) |
| | | let num = eval(this.replaceAll(arr[0],'RTS', this.RTS)) |
| | | return code[index] + ''+ num |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | replaceAll(str, find, replace) { |
| | | return str.replace(new RegExp(find, 'g'), replace); |
| | | }, |
| | | save() { |
| | | if (!this.addObj.companyId) { |
| | | this.$message.error('未选择客户单位') |
| | |
| | | this.$message.error('请输入样品型号') |
| | | } else if (!this.sampleList.every(m => m.standardMethodListId)) { |
| | | this.$message.error('请选择检验标准') |
| | | }else if (this.totalArr.find(a=>a.ask.includes('RTS')&&a.state==1)&&!this.RTS) { |
| | | this.$message.error('请输入RTS') |
| | | } else { |
| | | let sampleList = this.HaveJson(this.sampleList) |
| | | let isRTS = this.totalArr.find(a=>a.ask.includes('RTS')&&a.state==1) |
| | | if(isRTS){ |
| | | sampleList.forEach(item=>{ |
| | | if(item.insProduct&&item.insProduct.length>0){ |
| | | item.insProduct.forEach(a=>{ |
| | | if(a.state==1){ |
| | | let ask = this.handleAsk(a.ask) |
| | | if(ask&&a.state==1){ |
| | | a.ask = ask |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | // 光纤带项目 |
| | | if(item.bushing&&item.bushing.length>0){ |
| | | item.bushing.forEach(a=>{ |
| | | if(a.fiber&&a.fiber.length>0){ |
| | | a.fiber.forEach(b=>{ |
| | | if(b.productList&&b.productList.length>0){ |
| | | b.productList.forEach(c=>{ |
| | | if(c.state==1){ |
| | | let ask = this.handleAsk(c.ask) |
| | | if(ask&&c.state==1){ |
| | | c.ask = ask |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | if(a.fibers&&a.fibers.length>0){ |
| | | a.fibers.forEach(b=>{ |
| | | if(b.productList&&b.productList.length>0){ |
| | | b.productList.forEach(c=>{ |
| | | if(c.state==1){ |
| | | let ask = this.handleAsk(c.ask) |
| | | if(ask&&c.state==1){ |
| | | c.ask = ask |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | if(b.fiber&&b.fiber.length>0){ |
| | | b.fiber.forEach(c=>{ |
| | | if(c.productList&&c.productList.length>0){ |
| | | c.productList.forEach(d=>{ |
| | | if(d.state==1){ |
| | | let ask = this.handleAsk(d.ask) |
| | | if(ask){ |
| | | d.ask = ask |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | this.saveLoad = true |
| | | this.$axios.post(this.$api.insOrder.addInsOrder, { |
| | | insOrder: this.addObj, |
| | | list: JSON.stringify(this.sampleList.map(a => { |
| | | list: JSON.stringify(sampleList.map(a => { |
| | | a.model = a.model + ((a.modelNum == null || a.modelNum == '' || a.modelNum == 'null') ? '' : ( |
| | | '-' + a.modelNum)) |
| | | return a |
| | |
| | | this.addObj.code = selects.code |
| | | this.addObj.phone = selects.phone |
| | | this.addObj.companyId = selects.departId |
| | | this.addObj.production = '/' |
| | | this.addObj.productionEn = '/' |
| | | }) |
| | | }, |
| | | searchFilter() { |
| | |
| | | nodeClose(data, node, el) { |
| | | $($(el.$el).find('.node_i')[0]).attr('class', 'node_i el-icon-folder') |
| | | }, |
| | | handleNodeClick(val, node, el) { //树的值 |
| | | handleNodeClick(val, node, el) { |
| | | this.selectTree = '' |
| | | this.models = val.children |
| | | this.getNodeParent(node) |
| | |
| | | }, |
| | | upProductSelect(selection, row) { |
| | | row.state = row.state == 1 ? 0 : 1 |
| | | if (row.bsm === '1' && row.section !== '' && row.section !== null && row.state === 1) { |
| | | if(row.section.indexOf('[') > -1){ |
| | | this.bsmRow = this.HaveJson(row) |
| | | } |
| | | this.bsm1 = true |
| | | this.bsm1Dia = true |
| | | } else if (row.bsm === '1' && row.section !== '' && row.section !== null && row.state === 0) { |
| | | this.bsm1 = false |
| | | } |
| | | this.sampleList.map(item => { |
| | | if (this.sampleIds.indexOf(item.id) > -1) { |
| | | item.insProduct.map(m => { |
| | |
| | | return m |
| | | }) |
| | | } |
| | | this.productList.forEach(p=>{ |
| | | if (p.bsm === '1' && p.section !== '' && p.section !== null && p.state === 1) { |
| | | if(p.section.indexOf('[') > -1){ |
| | | this.bsmRow = this.HaveJson(p) |
| | | } |
| | | this.bsm1 = true |
| | | this.bsm1Dia = true |
| | | } else if (p.bsm === '1' && p.section !== '' && p.section !== null && p.state === 0) { |
| | | this.bsm1 = false |
| | | } |
| | | }) |
| | | if (e.length > 0) { |
| | | this.sampleList.map(item => { |
| | | if (this.sampleIds.indexOf(item.id) > -1) { |
| | |
| | | this.configShow = true |
| | | }) |
| | | } |
| | | }, |
| | | openEquipConfig(){ |
| | | if (this.active === 1) { |
| | | if (this.sampleIds.length === 0) { |
| | | this.$message.error("未选择样品") |
| | | return |
| | | } |
| | | this.equipConfigShow = true |
| | | } else { |
| | | if (this.sampleId === null) { |
| | | this.$message.error('未选中样品') |
| | | return |
| | | } |
| | | // this.$axios.post(this.$api.insBushing.selectBushingBySampleId, { |
| | | // sampleId: this.sampleId |
| | | // }).then(res => { |
| | | // if (res.data.length === 0) { |
| | | // this.$message.error('该样品没有配置光纤') |
| | | // return |
| | | // } |
| | | // for (var i in this.sampleList) { |
| | | // if (this.sampleList[i].id = this.sampleId) { |
| | | // this.sampleList[i].bushing = res.data |
| | | // break |
| | | // } |
| | | // } |
| | | // this.configShow = true |
| | | // }) |
| | | } |
| | | }, |
| | | upBsm1(val) { |
| | | let sections = JSON.parse(this.bsmRow.section); |
| | | let asks = JSON.parse(this.bsmRow.ask); |
| | | let tells = JSON.parse(this.bsmRow.tell); |
| | | let manHours = JSON.parse(this.bsmRow.manHour); |
| | | let prices = JSON.parse(this.bsmRow.price); |
| | | for (var a in sections) { |
| | | if(val === sections[a]){ |
| | | this.productList.forEach(p=>{ |
| | | if(p.id === this.bsmRow.id){ |
| | | p.section = sections[a] |
| | | p.ask = asks[a] |
| | | p.tell = tells[a] |
| | | p.manHour = manHours[a] |
| | | p.price = prices[a] |
| | | } |
| | | }) |
| | | break |
| | | } |
| | | } |
| | | }, |
| | | beforeClose(done){ |
| | | if(this.bsm1){ |
| | | if(this.bsm1Val===null || this.bsm1Val === ''){ |
| | | this.$message.error('特殊项目必须处理') |
| | | return |
| | | } |
| | | } |
| | | done() |
| | | }, |
| | | getTotal(){ |
| | | this.totalArr = [] |
| | | this.total = 0; |
| | | this.sampleList.forEach(item=>{ |
| | | if(item.insProduct&&item.insProduct.length>0){ |
| | | item.insProduct.forEach(a=>{ |
| | | this.totalArr.push(a) |
| | | }) |
| | | } |
| | | if(item.bushing&&item.bushing.length>0){ |
| | | item.bushing.forEach(a=>{ |
| | | if(a.fiber&&a.fiber.length>0){ |
| | | a.fiber.forEach(b=>{ |
| | | if(b.productList&&b.productList.length>0){ |
| | | b.productList.forEach(c=>{ |
| | | this.totalArr.push(c) |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | if(a.fibers&&a.fibers.length>0){ |
| | | a.fibers.forEach(b=>{ |
| | | if(b.productList&&b.productList.length>0){ |
| | | b.productList.forEach(c=>{ |
| | | this.totalArr.push(c) |
| | | }) |
| | | } |
| | | if(b.fiber&&b.fiber.length>0){ |
| | | b.fiber.forEach(c=>{ |
| | | if(c.productList&&c.productList.length>0){ |
| | | c.productList.forEach(d=>{ |
| | | this.totalArr.push(d) |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | let mySet = new Set(); |
| | | let arr0 = this.totalArr.filter(item=>{ |
| | | if(item.state == 1){ |
| | | let num1= mySet.size |
| | | if(item.manHourGroup===''||!item.manHourGroup){ |
| | | return true |
| | | }else{ |
| | | mySet.add(item.manHourGroup) |
| | | let num2= mySet.size |
| | | if(num2 > num1){ |
| | | return true |
| | | }else{ |
| | | return false |
| | | } |
| | | } |
| | | } |
| | | }) |
| | | arr0.forEach(item=>{ |
| | | this.total += Number(item.price) |
| | | }) |
| | | } |
| | | } |
| | | } |