Commit 1375d3d1faabb6e9463309732421a5fc82f219f3

Authored by hh
2 parents 4a2efd83 e1595999

Merge branch 'develop' of http://172.16.29.40:8010/wms/MMS-UI into develop

src/api/api.js
... ... @@ -102,6 +102,9 @@ export const getTechnology = (params)=>getAction("/sys/technology/getByHeader",
102 102 export const addTechnology = (params)=>postAction("/sys/technology/add", params);
103 103 export const editTechnology = (params)=>putAction("/sys/technology/edit", params);
104 104  
  105 +//成本核算
  106 +export const costCalcuate = (params)=>postAction("/parts_price/partsPrice/costCalcuate", params);
  107 +
105 108 //物料
106 109 export const addMaterial = (params)=>postAction("/sys/material/add", params);
107 110 export const editMaterial = (params)=>postAction("/sys/material/edit", params);
... ... @@ -172,6 +175,7 @@ export const getApiNameList = (params)=>getAction("/api_log/apiLog/getApiNameLis
172 175 export const queryProcess = (params)=>getAction('/plm/partlib/list', params);
173 176 export const queryPBom2 = (params)=>getAction('/plm/partlib/bomTree', params);
174 177 export const queryPBomByWms = (params)=>getAction('/pbom/pbom/treeList', params);
  178 +export const partList = (params)=>getAction('/working/working/partList', params);
175 179 export const queryOrderPBomByWms = (params)=>getAction('/pbom/pbom/orderTreeList', params);
176 180 export const queryCnoList = (params)=>getAction('/pbom/pbom/queryCnoList', params);
177 181 export const getWorkOrderList = (params)=>getAction('/workorder/workorder/getWorkOrderList', params);
... ...
src/views/parts_price/PartsPriceList.vue 0 → 100644
  1 +<template>
  2 + <a-card :bordered="false">
  3 + <!-- 查询区域 -->
  4 + <div class="table-page-search-wrapper">
  5 + <a-form layout="inline" @keyup.enter.native="searchQuery">
  6 + <a-row :gutter="24">
  7 + </a-row>
  8 + </a-form>
  9 + </div>
  10 + <!-- 查询区域-END -->
  11 +
  12 + <!-- 操作按钮区域 -->
  13 + <div class="table-operator">
  14 + <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  15 + <a-button type="primary" icon="download" @click="handleExportXls('零件单价')">导出</a-button>
  16 + <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
  17 + <a-button type="primary" icon="import">导入</a-button>
  18 + </a-upload>
  19 + <!-- 高级查询区域 -->
  20 + <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
  21 + <a-dropdown v-if="selectedRowKeys.length > 0">
  22 + <a-menu slot="overlay">
  23 + <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
  24 + </a-menu>
  25 + <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
  26 + </a-dropdown>
  27 + </div>
  28 +
  29 + <!-- table区域-begin -->
  30 + <div>
  31 + <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  32 + <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
  33 + <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  34 + </div>
  35 +
  36 + <a-table
  37 + ref="table"
  38 + size="middle"
  39 + :scroll="{x:true}"
  40 + bordered
  41 + rowKey="id"
  42 + :columns="columns"
  43 + :dataSource="dataSource"
  44 + :pagination="ipagination"
  45 + :loading="loading"
  46 + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  47 + class="j-table-force-nowrap"
  48 + @change="handleTableChange">
  49 +
  50 + <template slot="htmlSlot" slot-scope="text">
  51 + <div v-html="text"></div>
  52 + </template>
  53 + <template slot="imgSlot" slot-scope="text">
  54 + <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
  55 + <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
  56 + </template>
  57 + <template slot="fileSlot" slot-scope="text">
  58 + <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
  59 + <a-button
  60 + v-else
  61 + :ghost="true"
  62 + type="primary"
  63 + icon="download"
  64 + size="small"
  65 + @click="downloadFile(text)">
  66 + 下载
  67 + </a-button>
  68 + </template>
  69 +
  70 + <span slot="action" slot-scope="text, record">
  71 + <a @click="handleEdit(record)">编辑</a>
  72 +
  73 + <a-divider type="vertical" />
  74 + <a-dropdown>
  75 + <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
  76 + <a-menu slot="overlay">
  77 + <a-menu-item>
  78 + <a @click="handleDetail(record)">详情</a>
  79 + </a-menu-item>
  80 + <a-menu-item>
  81 + <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  82 + <a>删除</a>
  83 + </a-popconfirm>
  84 + </a-menu-item>
  85 + </a-menu>
  86 + </a-dropdown>
  87 + </span>
  88 +
  89 + </a-table>
  90 + </div>
  91 +
  92 + <parts-price-modal ref="modalForm" @ok="modalFormOk"></parts-price-modal>
  93 + </a-card>
  94 +</template>
  95 +
  96 +<script>
  97 +
  98 + import '@/assets/less/TableExpand.less'
  99 + import { mixinDevice } from '@/utils/mixin'
  100 + import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  101 + import PartsPriceModal from './modules/PartsPriceModal'
  102 +
  103 + export default {
  104 + name: 'PartsPriceList',
  105 + mixins:[JeecgListMixin, mixinDevice],
  106 + components: {
  107 + PartsPriceModal
  108 + },
  109 + data () {
  110 + return {
  111 + description: '零件单价管理页面',
  112 + // 表头
  113 + columns: [
  114 + {
  115 + title: '#',
  116 + dataIndex: '',
  117 + key:'rowIndex',
  118 + width:60,
  119 + align:"center",
  120 + customRender:function (t,r,index) {
  121 + return parseInt(index)+1;
  122 + }
  123 + },
  124 + {
  125 + title:'工作令',
  126 + align:"center",
  127 + dataIndex: 'workno'
  128 + },
  129 + {
  130 + title:'料号',
  131 + align:"center",
  132 + dataIndex: 'no'
  133 + },
  134 + {
  135 + title:'价格',
  136 + align:"center",
  137 + dataIndex: 'price'
  138 + },
  139 + {
  140 + title: '操作',
  141 + dataIndex: 'action',
  142 + align:"center",
  143 + fixed:"right",
  144 + width:147,
  145 + scopedSlots: { customRender: 'action' }
  146 + }
  147 + ],
  148 + url: {
  149 + list: "/parts_price/partsPrice/list",
  150 + delete: "/parts_price/partsPrice/delete",
  151 + deleteBatch: "/parts_price/partsPrice/deleteBatch",
  152 + exportXlsUrl: "/parts_price/partsPrice/exportXls",
  153 + importExcelUrl: "parts_price/partsPrice/importExcel",
  154 +
  155 + },
  156 + dictOptions:{},
  157 + superFieldList:[],
  158 + }
  159 + },
  160 + created() {
  161 + this.getSuperFieldList();
  162 + },
  163 + computed: {
  164 + importExcelUrl: function(){
  165 + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  166 + },
  167 + },
  168 + methods: {
  169 + initDictConfig(){
  170 + },
  171 + getSuperFieldList(){
  172 + let fieldList=[];
  173 + fieldList.push({type:'string',value:'workno',text:'工作令',dictCode:''})
  174 + fieldList.push({type:'string',value:'no',text:'料号',dictCode:''})
  175 + fieldList.push({type:'BigDecimal',value:'price',text:'价格',dictCode:''})
  176 + this.superFieldList = fieldList
  177 + }
  178 + }
  179 + }
  180 +</script>
  181 +<style scoped>
  182 + @import '~@assets/less/common.less';
  183 +</style>
0 184 \ No newline at end of file
... ...
src/views/parts_price/modules/PartsPriceForm.vue 0 → 100644
  1 +<template>
  2 + <a-spin :spinning="confirmLoading">
  3 + <j-form-container :disabled="formDisabled">
  4 + <a-form :form="form" slot="detail">
  5 + <a-row>
  6 + <a-col :span="24">
  7 + <a-form-item label="工作令" :labelCol="labelCol" :wrapperCol="wrapperCol">
  8 + <a-input v-decorator="['workno']" placeholder="请输入工作令" ></a-input>
  9 + </a-form-item>
  10 + </a-col>
  11 + <a-col :span="24">
  12 + <a-form-item label="料号" :labelCol="labelCol" :wrapperCol="wrapperCol">
  13 + <a-input v-decorator="['no']" placeholder="请输入料号" ></a-input>
  14 + </a-form-item>
  15 + </a-col>
  16 + <a-col :span="24">
  17 + <a-form-item label="价格" :labelCol="labelCol" :wrapperCol="wrapperCol">
  18 + <a-input-number v-decorator="['price']" placeholder="请输入价格" style="width: 100%" />
  19 + </a-form-item>
  20 + </a-col>
  21 + <a-col v-if="showFlowSubmitButton" :span="24" style="text-align: center">
  22 + <a-button @click="submitForm">提 交</a-button>
  23 + </a-col>
  24 + </a-row>
  25 + </a-form>
  26 + </j-form-container>
  27 + </a-spin>
  28 +</template>
  29 +
  30 +<script>
  31 +
  32 + import { httpAction, getAction } from '@/api/manage'
  33 + import pick from 'lodash.pick'
  34 + import { validateDuplicateValue } from '@/utils/util'
  35 +
  36 + export default {
  37 + name: 'PartsPriceForm',
  38 + components: {
  39 + },
  40 + props: {
  41 + //流程表单data
  42 + formData: {
  43 + type: Object,
  44 + default: ()=>{},
  45 + required: false
  46 + },
  47 + //表单模式:true流程表单 false普通表单
  48 + formBpm: {
  49 + type: Boolean,
  50 + default: false,
  51 + required: false
  52 + },
  53 + //表单禁用
  54 + disabled: {
  55 + type: Boolean,
  56 + default: false,
  57 + required: false
  58 + }
  59 + },
  60 + data () {
  61 + return {
  62 + form: this.$form.createForm(this),
  63 + model: {},
  64 + labelCol: {
  65 + xs: { span: 24 },
  66 + sm: { span: 5 },
  67 + },
  68 + wrapperCol: {
  69 + xs: { span: 24 },
  70 + sm: { span: 16 },
  71 + },
  72 + confirmLoading: false,
  73 + validatorRules: {
  74 + },
  75 + url: {
  76 + add: "/parts_price/partsPrice/add",
  77 + edit: "/parts_price/partsPrice/edit",
  78 + queryById: "/parts_price/partsPrice/queryById"
  79 + }
  80 + }
  81 + },
  82 + computed: {
  83 + formDisabled(){
  84 + if(this.formBpm===true){
  85 + if(this.formData.disabled===false){
  86 + return false
  87 + }
  88 + return true
  89 + }
  90 + return this.disabled
  91 + },
  92 + showFlowSubmitButton(){
  93 + if(this.formBpm===true){
  94 + if(this.formData.disabled===false){
  95 + return true
  96 + }
  97 + }
  98 + return false
  99 + }
  100 + },
  101 + created () {
  102 + //如果是流程中表单,则需要加载流程表单data
  103 + this.showFlowData();
  104 + },
  105 + methods: {
  106 + add () {
  107 + this.edit({});
  108 + },
  109 + edit (record) {
  110 + this.form.resetFields();
  111 + this.model = Object.assign({}, record);
  112 + this.visible = true;
  113 + this.$nextTick(() => {
  114 + this.form.setFieldsValue(pick(this.model,'workno','no','price'))
  115 + })
  116 + },
  117 + //渲染流程表单数据
  118 + showFlowData(){
  119 + if(this.formBpm === true){
  120 + let params = {id:this.formData.dataId};
  121 + getAction(this.url.queryById,params).then((res)=>{
  122 + if(res.success){
  123 + this.edit (res.result);
  124 + }
  125 + });
  126 + }
  127 + },
  128 + submitForm () {
  129 + const that = this;
  130 + // 触发表单验证
  131 + this.form.validateFields((err, values) => {
  132 + if (!err) {
  133 + that.confirmLoading = true;
  134 + let httpurl = '';
  135 + let method = '';
  136 + if(!this.model.id){
  137 + httpurl+=this.url.add;
  138 + method = 'post';
  139 + }else{
  140 + httpurl+=this.url.edit;
  141 + method = 'put';
  142 + }
  143 + let formData = Object.assign(this.model, values);
  144 + console.log("表单提交数据",formData)
  145 + httpAction(httpurl,formData,method).then((res)=>{
  146 + if(res.success){
  147 + that.$message.success(res.message);
  148 + that.$emit('ok');
  149 + }else{
  150 + that.$message.warning(res.message);
  151 + }
  152 + }).finally(() => {
  153 + that.confirmLoading = false;
  154 + })
  155 + }
  156 +
  157 + })
  158 + },
  159 + popupCallback(row){
  160 + this.form.setFieldsValue(pick(row,'workno','no','price'))
  161 + },
  162 + }
  163 + }
  164 +</script>
0 165 \ No newline at end of file
... ...
src/views/parts_price/modules/PartsPriceModal.vue 0 → 100644
  1 +<template>
  2 + <j-modal
  3 + :title="title"
  4 + :width="width"
  5 + :visible="visible"
  6 + switchFullscreen
  7 + @ok="handleOk"
  8 + :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
  9 + @cancel="handleCancel"
  10 + cancelText="关闭">
  11 + <parts-price-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></parts-price-form>
  12 + </j-modal>
  13 +</template>
  14 +
  15 +<script>
  16 +
  17 + import PartsPriceForm from './PartsPriceForm'
  18 + export default {
  19 + name: 'PartsPriceModal',
  20 + components: {
  21 + PartsPriceForm
  22 + },
  23 + data () {
  24 + return {
  25 + title:'',
  26 + width:800,
  27 + visible: false,
  28 + disableSubmit: false
  29 + }
  30 + },
  31 + methods: {
  32 + add () {
  33 + this.visible=true
  34 + this.$nextTick(()=>{
  35 + this.$refs.realForm.add();
  36 + })
  37 + },
  38 + edit (record) {
  39 + this.visible=true
  40 + this.$nextTick(()=>{
  41 + this.$refs.realForm.edit(record);
  42 + })
  43 + },
  44 + close () {
  45 + this.$emit('close');
  46 + this.visible = false;
  47 + },
  48 + handleOk () {
  49 + this.$refs.realForm.submitForm();
  50 + },
  51 + submitCallback(){
  52 + this.$emit('ok');
  53 + this.visible = false;
  54 + },
  55 + handleCancel () {
  56 + this.close()
  57 + }
  58 + }
  59 + }
  60 +</script>
0 61 \ No newline at end of file
... ...
src/views/parts_price/modules/PartsPriceModal__Style#Drawer.vue 0 → 100644
  1 +<template>
  2 + <a-drawer
  3 + :title="title"
  4 + :width="width"
  5 + placement="right"
  6 + :closable="false"
  7 + @close="close"
  8 + :visible="visible">
  9 + <parts-price-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></parts-price-form>
  10 + <div class="drawer-footer">
  11 + <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
  12 + <a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
  13 + </div>
  14 + </a-drawer>
  15 +</template>
  16 +
  17 +<script>
  18 +
  19 + import PartsPriceForm from './PartsPriceForm'
  20 +
  21 + export default {
  22 + name: 'PartsPriceModal',
  23 + components: {
  24 + PartsPriceForm
  25 + },
  26 + data () {
  27 + return {
  28 + title:"操作",
  29 + width:800,
  30 + visible: false,
  31 + disableSubmit: false
  32 + }
  33 + },
  34 + methods: {
  35 + add () {
  36 + this.visible=true
  37 + this.$nextTick(()=>{
  38 + this.$refs.realForm.add();
  39 + })
  40 + },
  41 + edit (record) {
  42 + this.visible=true
  43 + this.$nextTick(()=>{
  44 + this.$refs.realForm.edit(record);
  45 + });
  46 + },
  47 + close () {
  48 + this.$emit('close');
  49 + this.visible = false;
  50 + },
  51 + submitCallback(){
  52 + this.$emit('ok');
  53 + this.visible = false;
  54 + },
  55 + handleOk () {
  56 + this.$refs.realForm.submitForm();
  57 + },
  58 + handleCancel () {
  59 + this.close()
  60 + }
  61 + }
  62 + }
  63 +</script>
  64 +
  65 +<style lang="less" scoped>
  66 +/** Button按钮间距 */
  67 + .ant-btn {
  68 + margin-left: 30px;
  69 + margin-bottom: 30px;
  70 + float: right;
  71 + }
  72 + .drawer-footer{
  73 + position: absolute;
  74 + bottom: -8px;
  75 + width: 100%;
  76 + border-top: 1px solid #e8e8e8;
  77 + padding: 10px 16px;
  78 + text-align: right;
  79 + left: 0;
  80 + background: #fff;
  81 + border-radius: 0 0 2px 2px;
  82 + }
  83 +</style>
0 84 \ No newline at end of file
... ...
src/views/system/CostCalculate.vue 0 → 100644
  1 +<template>
  2 + <a-card :bordered="false">
  3 +
  4 + <!-- 查询区域 -->
  5 + <div class="table-page-search-wrapper">
  6 + <a-form layout="inline" @keyup.enter.native="searchQuery">
  7 + <a-row :gutter="24">
  8 +
  9 + <a-col :md="4" :sm="8">
  10 + <a-form-item label="工作令">
  11 + <a-input placeholder="请输入工作令" v-model="queryParam.field0056"></a-input>
  12 + </a-form-item>
  13 + </a-col>
  14 + <a-col :md="4" :sm="8">
  15 + <a-form-item label="项目名称">
  16 + <a-input placeholder="请输入项目名称" v-model="queryParam.field0047"></a-input>
  17 + </a-form-item>
  18 + </a-col>
  19 +
  20 +
  21 +
  22 + <a-col :md="6" :sm="8">
  23 + <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  24 + <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader"
  25 + :action="importExcelUrl" @change="handleImportExcel">
  26 + <a-button type="primary" icon="import">导入Excel</a-button>
  27 + </a-upload>
  28 + <a-button type="primary" @click="searchQuery" icon="search" style="margin-left: 8px">查询</a-button>
  29 + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  30 + </span>
  31 + </a-col>
  32 +
  33 + </a-row>
  34 + </a-form>
  35 + </div>
  36 +
  37 +
  38 + <a-table
  39 + ref="table"
  40 + size="middle"
  41 + :scroll="{x:true}"
  42 + bordered
  43 + rowKey="id"
  44 + :columns="columns"
  45 + class="j-table-force-nowrap"
  46 + :loading="loading"
  47 + :dataSource="dataSource"
  48 + :pagination="ipagination"
  49 + :customRow="clickThenSelect"
  50 + :rowClassName="rowClassName"
  51 + @change="handleTableChange"
  52 + >
  53 + <span slot="action" slot-scope="text, record">
  54 + <a-popconfirm title="确定开始核算这个项目吗?" @confirm="() =>costCalcuate(record)">
  55 + <a>成本核算</a>
  56 + </a-popconfirm>
  57 + </span>
  58 +
  59 + <span slot="getNoPrece" slot-scope="text, record">
  60 + <a @click="getNoPrece(record)">{{record.excel_flag}}</a>
  61 + </span>
  62 + </a-table>
  63 +
  64 +
  65 + <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;line-height:2">
  66 + 核算信息
  67 + </div>
  68 +
  69 + <div class="table-page-search-wrapper" style="margin-top: 20px">
  70 + <a-form layout="inline">
  71 + <a-row :gutter="24">
  72 + <a-col :md="6" :sm="8">
  73 + <a-form-item label="物料编码">
  74 + <a-input placeholder="物料编码" v-model="queryParam.cno"></a-input>
  75 + </a-form-item>
  76 + </a-col>
  77 + <a-col :md="6" :sm="8">
  78 + <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  79 + <a-button type="primary" @click="queryProjectByCno" icon="search">查询</a-button>
  80 + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  81 + </span>
  82 + </a-col>
  83 + </a-row>
  84 + </a-form>
  85 + </div>
  86 +
  87 + <a-table
  88 + :scroll="{x: 1500}"
  89 + ref="table"
  90 + size="middle"
  91 + rowKey="id"
  92 + :columns="planColumns"
  93 + :dataSource="bomSource"
  94 + :pagination="false"
  95 + :loading="loading2"
  96 + :expandedRowKeys="expandedRowKeys"
  97 + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: selectChanges}"
  98 + @change="handleTableChange"
  99 + @expand="handleExpand"
  100 + v-bind="tableProps">
  101 +
  102 +
  103 + <span slot="status" slot-scope="status, record">
  104 + <a-tag :key="status" :color="solutionColor(record)">
  105 + {{ confirmHandle(record) }}
  106 + </a-tag>
  107 + </span>
  108 +
  109 + <span slot="tradeNum" slot-scope="qty">
  110 + {{ numFormat(qty) }}
  111 + </span>
  112 +
  113 + <span slot="updateF04" slot-scope="text, record">
  114 + <a>{{ record.f04 }}</a>
  115 + </span>
  116 +
  117 + <span slot="checkQty" slot-scope="text, record">
  118 + <a @click="checkQty(record)">{{ numFormat(record.qty) }}</a>
  119 + </span>
  120 +
  121 + <!-- <span slot="action" slot-scope="action, record">-->
  122 + <!-- <a @click="handleEdit(record)">锁定工作令</a>-->normal
  123 + <!-- </span>-->
  124 + </a-table>
  125 + <!-- table区域-end -->
  126 + <pbom-type-form ref="pbomTypeForm" @fatherMethod="fatherMethodOther"></pbom-type-form>
  127 + <pbom-form ref="pbomForm"></pbom-form>
  128 + <materia-item-list ref="materiaFrom"></materia-item-list>
  129 + <PreparationList ref="modalForm2"></PreparationList>
  130 +
  131 + <j-popup
  132 + v-show="showRentPrise"
  133 + ref="no_price"
  134 + code="getNoPrece"
  135 + :param="materialParam"
  136 + org-fields="username"
  137 + dest-fields="popup"
  138 + field="popup"/>
  139 + </a-card>
  140 +</template>
  141 +
  142 +<script>
  143 +import {JeecgListMixin} from '../../mixins/JeecgListMixin'
  144 +import moment from 'moment'
  145 +import {ajaxGetDictItems, queryPBomByWms, queryCnoList,costCalcuate} from "../../api/api";
  146 +import {getAction} from '@/api/manage'
  147 +import PbomTypeForm from './modules/PbomTypeForm'
  148 +import PbomForm from './modules/PbomForm'
  149 +import MateriaItemList from "./modules/MateriaItemList";
  150 +import '@/assets/less/TableExpand.less'
  151 +import PreparationList from "./modules/PreparationList";
  152 +
  153 +export default {
  154 + name: 'CostCalculate',
  155 + components: {PbomTypeForm, PbomForm, MateriaItemList, PreparationList},
  156 + mixins: [JeecgListMixin],
  157 + data() {
  158 + return {
  159 + selectIndex: null,
  160 + queryParam: {},
  161 + materialParam:{workno:''},
  162 + description: '项目C表信息',
  163 + // 表头
  164 + url: {
  165 + list: '/pbom/pbom/projectList',
  166 + childList: "/pbom/pbom/childPriceList",
  167 + importExcelUrl: "parts_price/partsPrice/importExcel",
  168 + },
  169 + // 展开的行,受控属性
  170 + expandedRowKeys: [],
  171 + dataSource: [],
  172 + bomSource: [],
  173 + pnoArray: [],
  174 + scolor: '',
  175 + loading2: false,
  176 + pno: '',
  177 + pbom_status: '',
  178 + /* 分页参数 */
  179 + ipagination: {
  180 + current: 1,
  181 + pageSize: 5,
  182 + pageSizeOptions: ['5', '10', '50'],
  183 + showTotal: (total, range) => {
  184 + return range[0] + "-" + range[1] + " 共" + total + "条"
  185 + },
  186 + showQuickJumper: true,
  187 + showSizeChanger: true,
  188 + total: 0
  189 + },
  190 + hasChildrenField: "hasChild",
  191 + pidField: "pno",
  192 + workNo: '',
  193 + workName: '',
  194 + field0057: '',
  195 + projectNo: '',
  196 + pno_arr: '',
  197 + uuid: '',
  198 + dictOptions: {},
  199 + subExpandedKeys: [],
  200 + columns: [
  201 + {
  202 + title: '项目名称',
  203 + align: "center",
  204 + dataIndex: 'field0047',
  205 + key: 'field0047',
  206 + ellipsis: true
  207 + }, {
  208 + title: '工作令号',
  209 + align: 'center',
  210 + dataIndex: 'field0056',
  211 + key: 'field0056',
  212 + ellipsis: true
  213 + }, {
  214 + title: '存货编码',
  215 + align: 'center',
  216 + dataIndex: 'field0057',
  217 + key: 'field0057',
  218 + ellipsis: true
  219 + }, {
  220 + title: '签约客户',
  221 + align: 'center',
  222 + dataIndex: 'field0048',
  223 + key: 'field0048',
  224 + ellipsis: true
  225 + }, {
  226 + title: '交期要求',
  227 + align: 'center',
  228 + dataIndex: 'field0050',
  229 + key: 'field0050',
  230 + scopedSlots: {
  231 + customRender: 'tradeTime'
  232 + }
  233 + }, {
  234 + title: '是否上传',
  235 + align: 'center',
  236 + dataIndex: 'excel_flag',
  237 + key: 'excel_flag',
  238 + scopedSlots:{
  239 + customRender:'getNoPrece'
  240 + }
  241 + }, {
  242 + title: '核算次数',
  243 + align: 'center',
  244 + dataIndex: 'account',
  245 + key: 'account'
  246 + },
  247 + {
  248 + title: '操作',
  249 + dataIndex: 'action',
  250 + align: "center",
  251 + fixed: "right",
  252 + width:147,
  253 + scopedSlots: {customRender: 'action'},
  254 + }
  255 + ],
  256 + planColumns: [
  257 + {
  258 + title: '物料编码',
  259 + dataIndex: 'cno',
  260 + width: 100,
  261 + key: 'cno'
  262 + },
  263 + {
  264 + title: '图号',
  265 + dataIndex: 'f08',
  266 + width: 130,
  267 + key: 'f08'
  268 + },
  269 + {
  270 + title: '名称',
  271 + dataIndex: 'name',
  272 + align: 'center',
  273 + width: 100,
  274 + key: 'name'
  275 + }, {
  276 + title: '单位',
  277 + dataIndex: 'f02',
  278 + key: 'f02',
  279 + align: 'center',
  280 + width: 80
  281 + },
  282 + {
  283 + title: '制造方式',
  284 + dataIndex: 'f04',
  285 + width: 80,
  286 + align: 'center',
  287 + key: 'f04',
  288 + scopedSlots: {customRender: 'updateF04'}
  289 + },
  290 + ,{
  291 + title: 'WIP属性',
  292 + dataIndex: 'f05',
  293 + key: 'f05',
  294 + width: 80
  295 + },{
  296 + title: '分类',
  297 + dataIndex: 'f11',
  298 + width: 80,
  299 + key: 'f11'
  300 + },
  301 + {
  302 + title: '用量',
  303 + dataIndex: 'bnum',
  304 + key: 'bnum',
  305 + align: 'center',
  306 + width: 70,
  307 + scopedSlots: {
  308 + customRender: 'tradeNum'
  309 + }
  310 + },
  311 + {
  312 + title: '成本(元)',
  313 + dataIndex: 'price',
  314 + align: 'center',
  315 + key: 'price',
  316 + width: 70
  317 + }
  318 + // , {
  319 + // title: '物料状态',
  320 + // dataIndex: 'status',
  321 + // key: 'status',
  322 + // scopedSlots: { customRender: 'status' }
  323 + // }
  324 + ],
  325 + }
  326 + },
  327 + created() {
  328 + this.getOutSourceStatus()
  329 + },
  330 +
  331 + computed: {
  332 + importExcelUrl: function () {
  333 + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  334 + },
  335 + tableProps() {
  336 + let _this = this
  337 + return {
  338 + // 列表项是否可选择
  339 + rowSelection: {
  340 + selectedRowKeys: _this.selectedRowKeys,
  341 + onChange: (selectedRowKeys) => _this.selectedRowKeys = selectedRowKeys
  342 + }
  343 + }
  344 + },
  345 + },
  346 + methods: {
  347 + getNoPrece(data){
  348 + this.materialParam['workno'] ="''"+data.field0056+"''";
  349 + this.$refs.no_price.openModal();
  350 + },
  351 + costCalcuate(record){
  352 + if (record.excel_flag==undefined){
  353 + this.$message.warn("请先上传excel,再核算成本");
  354 + return false;
  355 + }
  356 + this.$message.info("开始后台计算成本,计算完成会发送系统通知!!")
  357 + let params = {
  358 + 'workno': record.field0056,
  359 + 'uuids': record.field0057 + ',' + record.field0054 + ',' + record.field0055
  360 + }
  361 + const that = this;
  362 + let obj = costCalcuate(params);
  363 + obj.then((res) => {
  364 + that.workContent = res;
  365 + })
  366 + },
  367 + searchQuery() {
  368 + this.loadData(1);
  369 + this.bomSource = [];
  370 + },
  371 + rowClassName(record, index) {
  372 + return index === this.selectIndex ? 'Rowactive' : ''
  373 + },
  374 +
  375 + clickThenSelect(record, index) {
  376 + return {
  377 + on: {
  378 + click: () => {
  379 + //当前行的索引
  380 + let that = this
  381 + that.selectIndex = index
  382 + this.bomSource = [];
  383 + this.workNo = record.field0056;
  384 + this.projectNo = record.id;
  385 + var field0057 = record.field0057 + ',' + record.field0054 + ',' + record.field0055
  386 + this.pno = field0057
  387 + this.pbom_status = '9'
  388 + this.workName = record.field0047
  389 + this.onSelectChangeByBoom(field0057, record.field0056, this.pbom_status);
  390 + }
  391 + }
  392 + }
  393 + },
  394 +
  395 + fatherMethodOther(str) {
  396 + this.onSelectChangeByBoom(this.pno, this.workNo, this.pbom_status);
  397 + },
  398 +
  399 + queryProjectByCno() {
  400 + this.loading2 = true
  401 + this.bomSource = [];
  402 + let params = {
  403 + 'cno': this.queryParam.cno,
  404 + 'workno': this.workno,
  405 + 'uuid': this.uuid
  406 + }
  407 + queryCnoList(params).then((res) => {
  408 + if (res.code == 0) {
  409 + this.loading2 = false
  410 + this.bomSource = this.getDataByResult(res.result.records);
  411 + this.uuid = res.result.records[0].uuid;
  412 + } else {
  413 + this.loading2 = false
  414 + this.bomSource = [];
  415 + this.$message.error(res.message)
  416 + }
  417 + })
  418 + },
  419 +
  420 + onSelectChangeByBoom(field0057, workno, pbom_status) {
  421 + this.loading2 = true
  422 + let params = {
  423 + 'pno': field0057,
  424 + 'workno': workno,
  425 + 'pbom_status': '9'
  426 + }
  427 + queryPBomByWms(params).then((res) => {
  428 + if (res.code == 0) {
  429 + this.loading2 = false
  430 + this.bomSource = this.getDataByResult(res.result.records);
  431 + this.uuid = res.result.records[0].uuid;
  432 + } else {
  433 + this.loading2 = false
  434 + this.bomSource = [];
  435 + this.$message.error(res.message)
  436 + }
  437 + })
  438 + },
  439 +
  440 + timeFormat(val) {
  441 + return moment(val).format('YYYY-MM-DD')
  442 + },
  443 + handleExpandedRowsChange(expandedRows) {
  444 + this.expandedRowKeys = expandedRows
  445 + },
  446 + handleBomChange(value) {
  447 + this.initBomTree(value)
  448 + },
  449 + onSelectAll(selected) {
  450 + if (selected) {
  451 + const tabData = this.bomSource;
  452 + const arr = [];
  453 + setVal(tabData, arr);
  454 + this.selectedRowKeys = arr;
  455 + } else {
  456 + this.selectedRowKeys = [];
  457 + }
  458 +
  459 + function setVal(list, arr) {
  460 + list.forEach(v => {
  461 + arr.push(v.key);
  462 + if (v.children) {
  463 + setVal(v.children, arr);
  464 + }
  465 + });
  466 + }
  467 + },
  468 + numFormat(qty) {
  469 + if (qty == undefined) {
  470 + return '';
  471 + } else {
  472 + return parseFloat(qty).toFixed(1);
  473 + }
  474 + },
  475 + onSelect(record, selected) {
  476 + const set = new Set(this.selectedRowKeys);
  477 + const tabData = this.bomSource;
  478 + const key = record.key;
  479 + if (selected) {
  480 + set.add(key);
  481 + record.children && setChildCheck(record.children);
  482 + // setParentCheck(key);
  483 + } else {
  484 + set.delete(key);
  485 + record.children && setChildUncheck(record.children);
  486 + setParentUncheck(key);
  487 + }
  488 +
  489 + this.selectedRowKeys = Array.from(set);
  490 +
  491 + // 设置父级选择
  492 + function setParentCheck(key) {
  493 + let parent = getParent(key);
  494 + if (parent) {
  495 + set.add(parent.key);
  496 + setParentCheck(parent.key);
  497 + }
  498 + }
  499 +
  500 + // 设置父级取消,如果父级的子集有选择,则不取消
  501 + function setParentUncheck(key) {
  502 + let childHasCheck = false,
  503 + parent = getParent(key);
  504 + if (parent) {
  505 + let childlist = parent.children;
  506 + childlist.forEach(function (v) {
  507 + if (set.has(v.key)) {
  508 + childHasCheck = true;
  509 + }
  510 + });
  511 + if (!childHasCheck) {
  512 + set.delete(parent.key);
  513 + setParentUncheck(parent.key);
  514 + }
  515 + }
  516 + }
  517 +
  518 + // 获取当前对象的父级
  519 + function getParent(key) {
  520 + for (let i = 0; i < tabData.length; i++) {
  521 + if (tabData[i].key === key) {
  522 + return null;
  523 + }
  524 + }
  525 + return _getParent(tabData);
  526 +
  527 + function _getParent(list) {
  528 + let childlist,
  529 + isExist = false;
  530 + for (let i = 0; i < list.length; i++) {
  531 + if ((childlist = list[i].children)) {
  532 + childlist.forEach(function (v) {
  533 + if (v.key === key) {
  534 + isExist = true;
  535 + }
  536 + });
  537 + if (isExist) {
  538 + return list[i];
  539 + }
  540 + if (_getParent(childlist)) {
  541 + return _getParent(childlist);
  542 + }
  543 + }
  544 + }
  545 + }
  546 + }
  547 +
  548 + // 设置child全选
  549 + function setChildCheck(list) {
  550 + list.forEach(function (v) {
  551 + set.add(v.key);
  552 + v.children && setChildCheck(v.children);
  553 + });
  554 + }
  555 +
  556 + // 设置child取消
  557 + function setChildUncheck(list) {
  558 + list.forEach(function (v) {
  559 + set.delete(v.key);
  560 + v.children && setChildUncheck(v.children);
  561 + });
  562 + }
  563 + },
  564 +
  565 + confirmHandle(record) {
  566 + var llqty = record.llqty;
  567 + if (llqty == undefined) {
  568 + llqty = '0';
  569 + }
  570 + var qty = record.qty;
  571 + if (qty == undefined) {
  572 + qty = '0';
  573 + }
  574 + var bnum = record.bnum;
  575 + if (bnum == undefined) {
  576 + bnum = '0';
  577 + }
  578 + var xnqty = parseInt(bnum) - parseInt(llqty)
  579 + var status = '';
  580 + if (parseInt(llqty) >= parseInt(bnum)) {
  581 + status = '2';
  582 + } else {
  583 + if (parseInt(xnqty) <= parseInt(qty)) {
  584 + status = '1';
  585 + } else {
  586 + status = '0';
  587 + }
  588 + }
  589 + if (record.qty == undefined) {
  590 + status = '';
  591 + }
  592 + var actions = []
  593 + Object.keys(this.outsourcingInStatusList).some((key) => {
  594 + if (this.outsourcingInStatusList[key].value == ('' + status)) {
  595 + actions.push(this.outsourcingInStatusList[key].text)
  596 + return true
  597 + }
  598 + })
  599 + return actions.join('')
  600 + },
  601 +
  602 + solutionColor(record) {
  603 + var llqty = record.llqty;
  604 + if (llqty == undefined) {
  605 + llqty = '0';
  606 + }
  607 + var qty = record.qty;
  608 + if (qty == undefined) {
  609 + qty = '0';
  610 + }
  611 + var bnum = record.bnum;
  612 + if (bnum == undefined) {
  613 + bnum = '0';
  614 + }
  615 + var xnqty = parseInt(bnum) - parseInt(llqty)
  616 + var status = '';
  617 + if (parseInt(llqty) >= parseInt(bnum)) {
  618 + status = '2';
  619 + } else {
  620 + if (parseInt(xnqty) <= parseInt(qty)) {
  621 + status = '1';
  622 + } else {
  623 + status = '0';
  624 + }
  625 + }
  626 + var actions = ''
  627 + Object.keys(this.outsourcingInStatusList).some((key) => {
  628 + if (this.outsourcingInStatusList[key].value == ('' + status)) {
  629 + actions = this.outsourcingInStatusList[key].color
  630 + }
  631 + })
  632 + return actions
  633 + },
  634 +
  635 + getOutSourceStatus() {
  636 + ajaxGetDictItems('bom_inv_status').then((res) => {
  637 + if (res.success) {
  638 + this.outsourcingInStatusList = res.result
  639 + }
  640 + })
  641 + },
  642 +
  643 +
  644 + getDataByResult(result) {
  645 + return result.map(item => {
  646 + //判断是否标记了带有子节点
  647 + if (item[this.hasChildrenField] == '1') {
  648 + let loadChild = {cno: item.cno + '_loadChild', name: 'loading2...', isLoading: true}
  649 + item.children = [loadChild]
  650 + }
  651 + return item
  652 + })
  653 + },
  654 +
  655 + handleExpand(expanded, record) {
  656 + // 判断是否是展开状态id
  657 + if (expanded) {
  658 + this.expandedRowKeys.push(record.id)
  659 + if (record.children.length > 0 && record.children[0].isLoading === true) {
  660 + let params = this.getQueryParams();//查询条件
  661 + params[this.pidField] = record.cno
  662 + params['uuid'] = record.uuid
  663 + params['pbom_status'] = '9'
  664 + getAction(this.url.childList, params).then((res) => {
  665 + if (res.success) {
  666 + if (res.result && res.result.length > 0) {
  667 + record.children = this.getDataByResult(res.result)
  668 + this.bomSource = [...this.bomSource]
  669 + } else {
  670 + record.children = ''
  671 + record.hasChildrenField = '0'
  672 + }
  673 + } else {
  674 + this.$message.warning(res.message)
  675 + }
  676 + })
  677 +
  678 + }
  679 +
  680 + } else {
  681 + let keyIndex = this.expandedRowKeys.indexOf(record.id)
  682 + if (keyIndex >= 0) {
  683 + this.expandedRowKeys.splice(keyIndex, 1);
  684 + }
  685 + }
  686 + },
  687 +
  688 + // 添加子分类时获取所有父级id
  689 + getExpandKeysByPid(pid, arr, all) {
  690 + if (pid && arr && arr.length > 0) {
  691 + for (let i = 0; i < arr.length; i++) {
  692 + if (arr[i].cno == pid) {
  693 + this.subExpandedKeys.push(arr[i].cno)
  694 + this.getExpandKeysByPid(arr[i]['pid'], all, all)
  695 + } else {
  696 + this.getExpandKeysByPid(pid, arr[i].children, all)
  697 + }
  698 + }
  699 + }
  700 + },
  701 + getFormDataById(cno, arr) {
  702 + if (arr && arr.length > 0) {
  703 + for (let i = 0; i < arr.length; i++) {
  704 + if (arr[i].cno == cno) {
  705 + this.parentFormData = arr[i]
  706 + } else {
  707 + this.getFormDataById(cno, arr[i].children)
  708 + }
  709 + }
  710 + }
  711 + },
  712 + expandTreeNode(nodeId) {
  713 + return new Promise((resolve, reject) => {
  714 + this.getFormDataById(nodeId, this.bomSource)
  715 + let row = this.parentFormData
  716 + this.expandedRowKeys.push(nodeId)
  717 + let params = this.getQueryParams();//查询条件
  718 + params[this.pidField] = nodeId
  719 + getAction(this.url.childList, params).then((res) => {
  720 + console.log("11111", res)
  721 + if (res.success) {
  722 + if (res.result && res.result.length > 0) {
  723 + row.children = this.getDataByResult(res.result)
  724 + this.bomSource = [...this.bomSource]
  725 + resolve()
  726 + } else {
  727 + row.children = ''
  728 + row.hasChildrenField = '0'
  729 + reject()
  730 + }
  731 + } else {
  732 + reject()
  733 + }
  734 + })
  735 + })
  736 + },
  737 +
  738 + // 根据已展开的行查询数据(用于保存后刷新时异步加载子级的数据)
  739 + loadDataByExpandedRows(dataList) {
  740 + if (this.expandedRowKeys.length > 0) {
  741 + return getAction(this.url.getChildListBatch, {parentIds: this.expandedRowKeys.join(',')}).then(res => {
  742 + if (res.success && res.result.records.length > 0) {
  743 + //已展开的数据批量子节点
  744 + let records = res.result.records
  745 + const listMap = new Map();
  746 + for (let item of records) {
  747 + let pid = item[this.pidField];
  748 + if (this.expandedRowKeys.join(',').includes(pid)) {
  749 + let mapList = listMap.get(pid);
  750 + if (mapList == null) {
  751 + mapList = [];
  752 + }
  753 + mapList.push(item);
  754 + listMap.set(pid, mapList);
  755 + }
  756 + }
  757 + let childrenMap = listMap;
  758 + let fn = (list) => {
  759 + if (list) {
  760 + list.forEach(data => {
  761 + if (this.expandedRowKeys.includes(data.cno)) {
  762 + data.children = this.getDataByResult(childrenMap.get(data.cno))
  763 + fn(data.children)
  764 + }
  765 + })
  766 + }
  767 + }
  768 + fn(dataList)
  769 + }
  770 + })
  771 + } else {
  772 + return Promise.resolve()
  773 + }
  774 + },
  775 +
  776 + //发起备料
  777 + toPreparation() {
  778 + if (this.workNo == "") {
  779 + this.$message.error("请先点击项目列表!");
  780 + return false;
  781 + }
  782 + this.$refs.modalForm2.show(this.workName, this.workNo)
  783 + },
  784 +
  785 + checkQty(record) {
  786 + this.$refs.materiaFrom.edit(record, this.workNo)
  787 + },
  788 +
  789 + selectChanges(selectedRowKeys, selectionRows) {
  790 + this.selectedRowKeys = selectedRowKeys;
  791 + this.selectionRows = selectionRows;
  792 + var array = '';
  793 + var uid = '';
  794 + this.selectionRows.forEach(function (row) {
  795 + array += row.cno + ",";
  796 + uid = row.uuid;
  797 + });
  798 + this.pno_arr = array
  799 + this.uuid = uid
  800 + },
  801 +
  802 + /** 点击a-table中的行后,展开或关闭其子行 */
  803 + tableClick(record, index) {
  804 + return {
  805 + style: {
  806 + cursor: 'pointer',
  807 + },
  808 + on: {
  809 + click: () => {
  810 + this.expandRowByClick = !this.expandRowByClick;
  811 + }
  812 + }
  813 + }
  814 + },
  815 + }
  816 +}
  817 +</script>
  818 +
  819 +<style scoped>
  820 +
  821 +</style>
0 822 \ No newline at end of file
... ...
src/views/working/PartWorking.vue
1   -<script src="../../permission.js"></script>
  1 +<script>
  2 +import PartBomList from "./modules/PartBomList";
  3 +export default {
  4 + components: {PartBomList}
  5 +}
  6 +</script>
2 7 <template>
3 8 <a-card :bordered="false">
4 9 <!-- 查询区域 -->
... ... @@ -58,6 +63,10 @@
58 63 <span slot="processWorking" slot-scope="text, record">
59 64 <a @click="processWorking(record)">{{record.time}}</a>
60 65 </span>
  66 +
  67 + <span slot="partBom" slot-scope="text, record">
  68 + <a @click="partBom(record)">{{record.partNo}}</a>
  69 + </span>
61 70 </a-table>
62 71  
63 72 </div>
... ... @@ -96,6 +105,8 @@
96 105 dest-fields="popup"
97 106 field="popup"/>
98 107 <materia-item-list ref="materiaFrom"></materia-item-list>
  108 + <part-bom-list ref="partBom"></part-bom-list>
  109 +
99 110 </a-card>
100 111 </template>
101 112  
... ... @@ -103,15 +114,15 @@
103 114 import { getPartWorkList,getProjectSum} from '@api/api'
104 115 import {JeecgListMixin} from '@/mixins/JeecgListMixin'
105 116 import { downFile } from '@/api/manage'
106   -import {ajaxGetDictItems} from "../../api/api";
107 117 import MateriaItemList from "../system/modules/MateriaItemList";
  118 +import PartBomList from "./modules/PartBomList";
108 119  
109 120  
110 121  
111 122 export default {
112 123 name: 'PartWorking',
113 124 mixins: [JeecgListMixin],
114   - components: {MateriaItemList},
  125 + components: {MateriaItemList,PartBomList},
115 126 data() {
116 127 return {
117 128 materialParam:{code:''},
... ... @@ -154,7 +165,10 @@ export default {
154 165 title: '部件号',
155 166 align: 'center',
156 167 dataIndex: 'partNo',
157   - ellipsis: true
  168 + ellipsis: true,
  169 + scopedSlots:{
  170 + customRender:'partBom'
  171 + }
158 172 },
159 173 {
160 174 title: '进度',
... ... @@ -221,6 +235,9 @@ export default {
221 235 this.loadFrom();
222 236 },
223 237 methods: {
  238 + partBom(data){
  239 + this.$refs.partBom.edit(data);
  240 + },
224 241 findCarNumberClick(row){
225 242 this.field0056=row.field0056;
226 243 this.field0054=row.field0054;
... ...
src/views/working/modules/PartBomList.vue 0 → 100644
  1 +<template>
  2 + <a-modal
  3 + title="部件BOM"
  4 + :width="1600"
  5 + :visible="visible"
  6 + :confirmLoading="confirmLoading"
  7 + @ok="handleOk"
  8 + @cancel="handleCancel"
  9 + cancelText="关闭"
  10 + wrapClassName="ant-modal-cust-warp"
  11 + style="top:5%;height: 85%;overflow-y: hidden">
  12 + <a-card :bordered="false">
  13 +
  14 + <!-- 查询区域 -->
  15 +
  16 + <p3>项目名称:{{projectName}}</p3>
  17 + <a-table
  18 + :scroll="{x: scrollXWidth, y: 720}"
  19 + ref="table"
  20 + size="middle"
  21 + rowKey="id"
  22 + :columns="planColumns"
  23 + :dataSource="bomSource"
  24 + :pagination="false"
  25 + :loading="loading2"
  26 + :expandedRowKeys="expandedRowKeys"
  27 + :rowSelection="{selectedRowKeys: selectedRowKeys,onChange: selectChanges}"
  28 + @change="handleTableChange"
  29 + @expand="handleExpand"
  30 + v-bind="tableProps" >
  31 +
  32 +
  33 + </a-table>
  34 + <!-- table区域-end -->
  35 + <pbom-form ref="pbomForm"></pbom-form>
  36 + <materia-item-list ref="materiaFrom"></materia-item-list>
  37 + </a-card>
  38 + </a-modal>
  39 +</template>
  40 +
  41 +<script>
  42 +import { JeecgListMixin } from '../../../mixins/JeecgListMixin'
  43 +import moment from 'moment'
  44 +import {ajaxGetDictItems, partList} from "../../../api/api";
  45 +import { getAction } from '@/api/manage'
  46 +import '@/assets/less/TableExpand.less'
  47 +
  48 +export default {
  49 + name: 'PartBomList',
  50 + components: {},
  51 + mixins: [JeecgListMixin],
  52 + data() {
  53 + return {
  54 + visible: false,
  55 + confirmLoading: false,
  56 + selectIndex: null,
  57 + queryParam: {},
  58 + description: '项目C表信息',
  59 + loading2:false,
  60 + scrollXWidth: 1800,
  61 + headerId:'',
  62 + // 表头
  63 + url: {
  64 + list:'1',
  65 + childList: "/working/working/childList",
  66 + },
  67 + // 展开的行,受控属性
  68 + expandedRowKeys: [],
  69 + dataSource: [],
  70 + bomSource: [],
  71 + pnoArray:[],
  72 + scolor:'',
  73 + pno:'',
  74 + pbom_status:'',
  75 + projectName:'',
  76 + /* 分页参数 */
  77 + ipagination:{
  78 + current: 1,
  79 + pageSize: 5,
  80 + pageSizeOptions: ['5', '10', '50'],
  81 + showTotal: (total, range) => {
  82 + return range[0] + "-" + range[1] + " 共" + total + "条"
  83 + },
  84 + showQuickJumper: true,
  85 + showSizeChanger: true,
  86 + total: 0
  87 + },
  88 + hasChildrenField:"hasChild",
  89 + pidField:"pno",
  90 + workNo:'',
  91 + field0057:'',
  92 + projectNo:'',
  93 + pno_arr:'',
  94 + uuid:'',
  95 + dictOptions:{
  96 + },
  97 + subExpandedKeys:[],
  98 + planColumns: [
  99 + {
  100 + title: '部件名称',
  101 + dataIndex: 'partName',
  102 + width: 100,
  103 + key: 'partName'
  104 + },
  105 + {
  106 + title: '部件编码',
  107 + dataIndex: 'cno',
  108 + width: 130,
  109 + key: 'cno'
  110 + },
  111 + {
  112 + title: '报工人数',
  113 + dataIndex: 'nums',
  114 + align: 'center',
  115 + width: 100,
  116 + key: 'nums'
  117 + }, {
  118 + title: '合格数量',
  119 + dataIndex: 'qty',
  120 + key: 'qty',
  121 + align: 'center',
  122 + width: 80
  123 + },
  124 + {
  125 + title: '总工时(小时)',
  126 + align: 'center',
  127 + dataIndex: 'hours',
  128 + scopedSlots:{
  129 + customRender:'departWorking'
  130 + }
  131 + },
  132 + {
  133 + title: '总工时(分钟)',
  134 + align: 'center',
  135 + dataIndex: 'time',
  136 + scopedSlots:{
  137 + customRender:'processWorking'
  138 + }
  139 + },
  140 + {
  141 + title: '重量(kg)',
  142 + align: 'center',
  143 + dataIndex: 'weight',
  144 + key: 'weight'
  145 + }
  146 + ],
  147 + }
  148 + },
  149 + created() {
  150 + this.getOutSourceStatus()
  151 + this.getdata()
  152 + },
  153 + computed:{
  154 + tableProps() {
  155 + let _this = this
  156 + return {
  157 + // 列表项是否可选择
  158 + rowSelection: {
  159 + selectedRowKeys: _this.selectedRowKeys,
  160 + onChange: (selectedRowKeys) => _this.selectedRowKeys = selectedRowKeys
  161 + }
  162 + }
  163 + },
  164 + },
  165 + methods: {
  166 + edit (record) {
  167 + this.projectName=record.projectName
  168 + this.visible = true;
  169 + this.onSelectChangeByBoom(record)
  170 + },
  171 + handleCancel () {
  172 + this.visible = false;
  173 + },
  174 + handleOk () {
  175 + this.visible = false;
  176 + },
  177 + getdata(){
  178 + let currColumns = this.planColumns
  179 + // res.result.columns表示接口获取的columns值,具体根据接口返回值修改
  180 + for(let a=0;a<currColumns.length;a++){
  181 + // 设置除最后一列的宽度,需要空一列自适应
  182 + if(a < currColumns.length-1) {
  183 + currColumns[a].width = 150;
  184 + }
  185 + }
  186 + console.log("-------------------",currColumns)
  187 + // 横向滚动长度大于所有宽度,才能实现固定表头
  188 + this.scrollXWidth = (currColumns.length) * 150 + 180;
  189 + this.planColumns = [...currColumns]
  190 + },
  191 + searchQuery() {
  192 + this.loadData(1);
  193 + this.bomSource=[];
  194 + },
  195 +
  196 + rowClassName(record, index) {
  197 + return index === this.selectIndex ? 'Rowactive' : ''
  198 + },
  199 +
  200 +
  201 +
  202 + onSelectChangeByBoom(data) {
  203 + this.headerId=data.headerId
  204 + this.loading2 = true
  205 + let params = {
  206 + 'headerId':data.headerId,
  207 + 'id':data.id,
  208 + 'projectName': data.projectName,
  209 + 'partName': data.partName,
  210 + 'nums': data.nums,
  211 + 'time': data.time,
  212 + 'qty': data.qty,
  213 + 'status1': data.status1,
  214 + 'status2': data.status2,
  215 + 'status3': data.status3,
  216 + 'hours': data.hours,
  217 + 'partNo': data.partNo,
  218 + 'progress': data.progress,
  219 + }
  220 + partList(params).then((res) => {
  221 + if (res.code==0) {
  222 + this.loading2 = false
  223 + this.bomSource=this.getDataByResult(res.result.records);
  224 + }else{
  225 + this.loading2 = false
  226 + this.bomSource=[];
  227 + this.$message.error(res.message)
  228 + }
  229 + })
  230 + },
  231 +
  232 + timeFormat(val) {
  233 + return moment(val).format('YYYY-MM-DD')
  234 + },
  235 + handleExpandedRowsChange(expandedRows) {
  236 + this.expandedRowKeys = expandedRows
  237 + },
  238 + handleBomChange(value) {
  239 + this.initBomTree(value)
  240 + },
  241 + onSelectAll(selected) {
  242 + if (selected) {
  243 + const tabData = this.bomSource;
  244 + const arr = [];
  245 + setVal(tabData, arr);
  246 + this.selectedRowKeys = arr;
  247 + } else {
  248 + this.selectedRowKeys = [];
  249 + }
  250 + function setVal(list, arr) {
  251 + list.forEach(v => {
  252 + arr.push(v.key);
  253 + if (v.children) {
  254 + setVal(v.children, arr);
  255 + }
  256 + });
  257 + }
  258 + },
  259 + numFormat(qty){
  260 + if(qty==undefined){
  261 + return '';
  262 + }else{
  263 + return parseFloat(qty).toFixed(1);
  264 + }
  265 + },
  266 + onSelect(record, selected) {
  267 + const set = new Set(this.selectedRowKeys);
  268 + const tabData = this.bomSource;
  269 + const key = record.key;
  270 + if (selected) {
  271 + set.add(key);
  272 + record.children && setChildCheck(record.children);
  273 + // setParentCheck(key);
  274 + } else {
  275 + set.delete(key);
  276 + record.children && setChildUncheck(record.children);
  277 + setParentUncheck(key);
  278 + }
  279 +
  280 + this.selectedRowKeys = Array.from(set);
  281 + // 设置父级选择
  282 + function setParentCheck(key) {
  283 + let parent = getParent(key);
  284 + if (parent) {
  285 + set.add(parent.key);
  286 + setParentCheck(parent.key);
  287 + }
  288 + }
  289 + // 设置父级取消,如果父级的子集有选择,则不取消
  290 + function setParentUncheck(key) {
  291 + let childHasCheck = false,
  292 + parent = getParent(key);
  293 + if (parent) {
  294 + let childlist = parent.children;
  295 + childlist.forEach(function(v) {
  296 + if (set.has(v.key)) {
  297 + childHasCheck = true;
  298 + }
  299 + });
  300 + if (!childHasCheck) {
  301 + set.delete(parent.key);
  302 + setParentUncheck(parent.key);
  303 + }
  304 + }
  305 + }
  306 + // 获取当前对象的父级
  307 + function getParent(key) {
  308 + for (let i = 0; i < tabData.length; i++) {
  309 + if (tabData[i].key === key) {
  310 + return null;
  311 + }
  312 + }
  313 + return _getParent(tabData);
  314 + function _getParent(list) {
  315 + let childlist,
  316 + isExist = false;
  317 + for (let i = 0; i < list.length; i++) {
  318 + if ((childlist = list[i].children)) {
  319 + childlist.forEach(function(v) {
  320 + if (v.key === key) {
  321 + isExist = true;
  322 + }
  323 + });
  324 + if (isExist) {
  325 + return list[i];
  326 + }
  327 + if (_getParent(childlist)) {
  328 + return _getParent(childlist);
  329 + }
  330 + }
  331 + }
  332 + }
  333 + }
  334 + // 设置child全选
  335 + function setChildCheck(list) {
  336 + list.forEach(function(v) {
  337 + set.add(v.key);
  338 + v.children && setChildCheck(v.children);
  339 + });
  340 + }
  341 + // 设置child取消
  342 + function setChildUncheck(list) {
  343 + list.forEach(function(v) {
  344 + set.delete(v.key);
  345 + v.children && setChildUncheck(v.children);
  346 + });
  347 + }
  348 + },
  349 +
  350 + confirmHandle(record) {
  351 + var llqty=record.llqty;
  352 + if (llqty==undefined){
  353 + llqty='0';
  354 + }
  355 + var qty=record.qty;
  356 + if (qty==undefined){
  357 + qty='0';
  358 + }
  359 + var bnum=record.bnum;
  360 + if (bnum==undefined){
  361 + bnum='0';
  362 + }
  363 + var xnqty=parseInt(bnum)-parseInt(llqty)
  364 + var status='';
  365 + if (parseInt(llqty) >= parseInt(bnum)) {
  366 + status= '2';
  367 + } else {
  368 + if (parseInt(xnqty) <= parseInt(qty)) {
  369 + status= '1';
  370 + } else {
  371 + status= '0';
  372 + }
  373 + }
  374 + if(record.qty==undefined){
  375 + status='';
  376 + }
  377 + var actions = []
  378 + Object.keys(this.outsourcingInStatusList).some((key) => {
  379 + if (this.outsourcingInStatusList[key].value == ('' + status)) {
  380 + actions.push(this.outsourcingInStatusList[key].text)
  381 + return true
  382 + }
  383 + })
  384 + return actions.join('')
  385 + },
  386 +
  387 + solutionColor(record) {
  388 + var llqty=record.llqty;
  389 + if (llqty==undefined){
  390 + llqty='0';
  391 + }
  392 + var qty=record.qty;
  393 + if (qty==undefined){
  394 + qty='0';
  395 + }
  396 + var bnum=record.bnum;
  397 + if (bnum==undefined){
  398 + bnum='0';
  399 + }
  400 + var xnqty=parseInt(bnum)-parseInt(llqty)
  401 + var status='';
  402 + if (parseInt(llqty) >= parseInt(bnum)) {
  403 + status= '2';
  404 + } else {
  405 + if (parseInt(xnqty) <= parseInt(qty)) {
  406 + status= '1';
  407 + } else {
  408 + status= '0';
  409 + }
  410 + }
  411 + var actions = ''
  412 + Object.keys(this.outsourcingInStatusList).some((key) => {
  413 + if (this.outsourcingInStatusList[key].value == ('' + status)) {
  414 + actions = this.outsourcingInStatusList[key].color
  415 + }
  416 + })
  417 + return actions
  418 + },
  419 +
  420 + getOutSourceStatus() {
  421 + ajaxGetDictItems('bom_inv_status').then((res) => {
  422 + if (res.success) {
  423 + this.outsourcingInStatusList = res.result
  424 + }
  425 + })
  426 + },
  427 +
  428 +
  429 + getDataByResult(result){
  430 + return result.map(item=>{
  431 + //判断是否标记了带有子节点
  432 + if(item[this.hasChildrenField]=='1'){
  433 + let loadChild = { cno: item.cno+'_loadChild', name: 'loading...', isLoading: true }
  434 + item.children = [loadChild]
  435 + }
  436 + return item
  437 + })
  438 + },
  439 +
  440 + handleExpand(expanded, record){
  441 + // 判断是否是展开状态id
  442 + if (expanded) {
  443 + this.expandedRowKeys.push(record.id)
  444 + debugger
  445 + if (record.children.length>0 && record.children[0].isLoading === true) {
  446 + // let params = this.getQueryParams();//查询条件
  447 + let params = {
  448 + "headerId":this.headerId,
  449 + "partNo":record.partNo,
  450 + "cno":record.cno,
  451 + "pno":record.cno
  452 + };//查询条件
  453 + // params[this.pidField] = record.cno
  454 + // params['headerId'] = record.headerId
  455 + // params['partNo'] = record.partNo
  456 + // params['cno'] = record.cno
  457 + // params['cno'] = record.cno
  458 + getAction(this.url.childList,params).then((res)=>{
  459 + if(res.success){
  460 + if(res.result && res.result.length>0){
  461 + record.children = this.getDataByResult(res.result)
  462 + this.bomSource = [...this.bomSource]
  463 + }else{
  464 + record.children=''
  465 + record.hasChildrenField='0'
  466 + }
  467 + }else{
  468 + this.$message.warning(res.message)
  469 + }
  470 + })
  471 +
  472 + }
  473 +
  474 + }else{
  475 + let keyIndex = this.expandedRowKeys.indexOf(record.id)
  476 + if(keyIndex>=0){
  477 + this.expandedRowKeys.splice(keyIndex, 1);
  478 + }
  479 + }
  480 + },
  481 +
  482 + // 添加子分类时获取所有父级id
  483 + getExpandKeysByPid(pid,arr,all){
  484 + if(pid && arr && arr.length>0){
  485 + for(let i=0;i<arr.length;i++){
  486 + if(arr[i].cno==pid){
  487 + this.subExpandedKeys.push(arr[i].cno)
  488 + this.getExpandKeysByPid(arr[i]['pid'],all,all)
  489 + }else{
  490 + this.getExpandKeysByPid(pid,arr[i].children,all)
  491 + }
  492 + }
  493 + }
  494 + },
  495 + getFormDataById(cno,arr){
  496 + if(arr && arr.length>0){
  497 + for(let i=0;i<arr.length;i++){
  498 + if(arr[i].cno==cno){
  499 + this.parentFormData = arr[i]
  500 + }else{
  501 + this.getFormDataById(cno,arr[i].children)
  502 + }
  503 + }
  504 + }
  505 + },
  506 + expandTreeNode(nodeId){
  507 + return new Promise((resolve,reject)=>{
  508 + this.getFormDataById(nodeId,this.bomSource)
  509 + let row = this.parentFormData
  510 + this.expandedRowKeys.push(nodeId)
  511 + let params = this.getQueryParams();//查询条件
  512 + params[this.pidField] = nodeId
  513 + getAction(this.url.childList,params).then((res)=>{
  514 + if(res.success){
  515 + if(res.result && res.result.length>0){
  516 + row.children = this.getDataByResult(res.result)
  517 + this.bomSource = [...this.bomSource]
  518 + resolve()
  519 + }else{
  520 + row.children=''
  521 + row.hasChildrenField='0'
  522 + reject()
  523 + }
  524 + }else{
  525 + reject()
  526 + }
  527 + })
  528 + })
  529 + },
  530 +
  531 + // 根据已展开的行查询数据(用于保存后刷新时异步加载子级的数据)
  532 + loadDataByExpandedRows(dataList) {
  533 + if (this.expandedRowKeys.length > 0) {
  534 + return getAction(this.url.getChildListBatch,{ parentIds: this.expandedRowKeys.join(',') }).then(res=>{
  535 + if (res.success && res.result.records.length>0) {
  536 + //已展开的数据批量子节点
  537 + let records = res.result.records
  538 + const listMap = new Map();
  539 + for (let item of records) {
  540 + let pid = item[this.pidField];
  541 + if (this.expandedRowKeys.join(',').includes(pid)) {
  542 + let mapList = listMap.get(pid);
  543 + if (mapList == null) {
  544 + mapList = [];
  545 + }
  546 + mapList.push(item);
  547 + listMap.set(pid, mapList);
  548 + }
  549 + }
  550 + let childrenMap = listMap;
  551 + let fn = (list) => {
  552 + if(list) {
  553 + list.forEach(data => {
  554 + if (this.expandedRowKeys.includes(data.cno)) {
  555 + data.children = this.getDataByResult(childrenMap.get(data.cno))
  556 + fn(data.children)
  557 + }
  558 + })
  559 + }
  560 + }
  561 + fn(dataList)
  562 + }
  563 + })
  564 + } else {
  565 + return Promise.resolve()
  566 + }
  567 + },
  568 +
  569 + selectChanges(selectedRowKeys, selectionRows) {
  570 + this.selectedRowKeys = selectedRowKeys;
  571 + this.selectionRows = selectionRows;
  572 + var array='';
  573 + var uid='';
  574 + this.selectionRows.forEach(function (row) {
  575 + array += row.cno + ",";
  576 + });
  577 + this.pno_arr=array
  578 + },
  579 +
  580 +
  581 + /** 点击a-table中的行后,展开或关闭其子行 */
  582 + tableClick(record, index){
  583 + return {
  584 + style:{
  585 + cursor:'pointer',
  586 + },
  587 + on: {
  588 + click: () => {
  589 + this.expandRowByClick = !this.expandRowByClick;
  590 + }
  591 + }
  592 + }
  593 + },
  594 + }
  595 +}
  596 +</script>
  597 +
  598 +<style scoped>
  599 +
  600 +</style>
0 601 \ No newline at end of file
... ...