| | |
| | | @pagination="pagination" |
| | | :total="page.total"></PIMTable> |
| | | </div> |
| | | |
| | | <!-- å·¥åºç产记å½åè¡¨å¼¹æ¡ --> |
| | | <el-dialog v-model="isShowProcessParamModal" |
| | | title="ç产记å½" |
| | | width="800px"> |
| | | <div style="text-align: right" |
| | | class="mb10"> |
| | | <el-button type="primary" |
| | | @click="showSelectProductParamModal">æ°å¢</el-button> |
| | | <el-button type="danger" |
| | | plain |
| | | @click="handleDeleteProcessParam" |
| | | :disabled="processParamSelectedRows.length === 0">æ¹éå é¤</el-button> |
| | | </div> |
| | | <PIMTable rowKey="id" |
| | | :column="processParamColumns" |
| | | :tableData="processParamTableData" |
| | | :page="processParamPage" |
| | | :isSelection="true" |
| | | @selection-change="handleProcessParamSelectionChange" |
| | | @pagination="processParamPagination" |
| | | :total="processParamPage.total"></PIMTable> |
| | | </el-dialog> |
| | | |
| | | <!-- éæ©ç产记å½å¼¹æ¡ --> |
| | | <el-dialog v-model="isShowSelectParamModal" |
| | | title="éæ©ç产记å½" |
| | | width="800px"> |
| | | <PIMTable rowKey="id" |
| | | :column="productParamColumns" |
| | | :tableData="productParamTableData" |
| | | :page="productParamPage" |
| | | :isSelection="true" |
| | | @selection-change="handleProductParamSelectionChange" |
| | | @pagination="productParamPagination" |
| | | :total="productParamPage.total"></PIMTable> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" |
| | | @click="handleAddProcessParam">ç¡®å®</el-button> |
| | | <el-button @click="isShowSelectParamModal = false">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <new-process v-if="isShowNewModal" |
| | | v-model:visible="isShowNewModal" |
| | | @completed="getList" /> |
| | |
| | | importData, |
| | | downloadTemplate, |
| | | } from "@/api/productionManagement/productionProcess.js"; |
| | | import { |
| | | listPage as listProcessParamPage, |
| | | del as delProcessParam, |
| | | addProductProcessParameter, |
| | | } from "@/api/productionManagement/productProcessParameter.js"; |
| | | import { listPage as listProductParamPage } from "@/api/productionManagement/productionRecords.js"; |
| | | import { getToken } from "@/utils/auth"; |
| | | |
| | | const data = reactive({ |
| | |
| | | width: 280, |
| | | operation: [ |
| | | { |
| | | name: "æ¥ç", |
| | | type: "text", |
| | | clickFun: row => { |
| | | showProcessParamModal(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: "ç¼è¾", |
| | | type: "text", |
| | | clickFun: row => { |
| | |
| | | ], |
| | | }, |
| | | ]); |
| | | // å·¥åºå·²ç»å®çç产记å½å表åé
ç½® |
| | | const processParamColumns = ref([ |
| | | { label: "åæ°ç¼ç ", prop: "code" }, |
| | | { label: "忰项", prop: "parameterItem" }, |
| | | { |
| | | label: "åæ°ç±»å", |
| | | prop: "type", |
| | | formatData: val => { |
| | | const dictList = (proxy.useDict && proxy.useDict("parameter_tyep")?.parameter_tyep) || []; |
| | | const list = dictList.value || dictList; |
| | | const hit = (list || []).find(d => d.value === val); |
| | | return hit ? hit.label : val; |
| | | }, |
| | | }, |
| | | { label: "åä½", prop: "unit" }, |
| | | { label: "åæ°æ ¼å¼", prop: "parameterFormat" }, |
| | | { |
| | | label: "æ¯å¦å¿
å¡«", |
| | | prop: "isRequired", |
| | | formatData: v => (v === "1" || v === 1 ? "æ¯" : "å¦"), |
| | | }, |
| | | ]); |
| | | // å¯éæ©çç产记å½å表åé
ç½® |
| | | const productParamColumns = ref([ |
| | | { label: "åæ°ç¼ç ", prop: "code" }, |
| | | { label: "忰项", prop: "parameterItem" }, |
| | | { |
| | | label: "åæ°ç±»å", |
| | | prop: "type", |
| | | formatData: val => { |
| | | const dictList = (proxy.useDict && proxy.useDict("parameter_tyep")?.parameter_tyep) || []; |
| | | const list = dictList.value || dictList; |
| | | const hit = (list || []).find(d => d.value === val); |
| | | return hit ? hit.label : val; |
| | | }, |
| | | }, |
| | | { label: "åä½", prop: "unit" }, |
| | | { label: "åæ°æ ¼å¼", prop: "parameterFormat" }, |
| | | { |
| | | label: "æ¯å¦å¿
å¡«", |
| | | prop: "isRequired", |
| | | formatData: v => (v === "1" || v === 1 ? "æ¯" : "å¦"), |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const tableLoading = ref(false); |
| | | const isShowNewModal = ref(false); |
| | | const isShowEditModal = ref(false); |
| | | const isShowProcessParamModal = ref(false); |
| | | const isShowSelectParamModal = ref(false); |
| | | const record = ref({}); |
| | | const currentProcess = ref(null); |
| | | const importDialogVisible = ref(false); |
| | | const importDialogRef = ref(null); |
| | | const page = reactive({ |
| | |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | const processParamPage = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | const productParamPage = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | const processParamTableData = ref([]); |
| | | const productParamTableData = ref([]); |
| | | const processParamSelectedRows = ref([]); |
| | | const productParamSelectedRows = ref([]); |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | // 导å
¥ç¸å
³é
ç½® |
| | |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | const processParamPagination = obj => { |
| | | processParamPage.current = obj.page; |
| | | processParamPage.size = obj.limit; |
| | | getProcessParamList(); |
| | | }; |
| | | const productParamPagination = obj => { |
| | | productParamPage.current = obj.page; |
| | | productParamPage.size = obj.limit; |
| | | getProductParamList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | |
| | | selectedRows.value = selection; |
| | | }; |
| | | |
| | | const handleProcessParamSelectionChange = selection => { |
| | | processParamSelectedRows.value = selection; |
| | | }; |
| | | |
| | | const handleProductParamSelectionChange = selection => { |
| | | productParamSelectedRows.value = selection; |
| | | }; |
| | | |
| | | // æå¼æ°å¢å¼¹æ¡ |
| | | const showNewModal = () => { |
| | | isShowNewModal.value = true; |
| | |
| | | record.value = row; |
| | | }; |
| | | |
| | | // æ¥çå½åå·¥åºççäº§è®°å½ |
| | | const showProcessParamModal = row => { |
| | | currentProcess.value = row; |
| | | isShowProcessParamModal.value = true; |
| | | processParamPage.current = 1; |
| | | getProcessParamList(); |
| | | }; |
| | | |
| | | const getProcessParamList = () => { |
| | | if (!currentProcess.value) return; |
| | | const params = { |
| | | processId: currentProcess.value.id, |
| | | ...processParamPage, |
| | | }; |
| | | listProcessParamPage(params).then(res => { |
| | | processParamTableData.value = res.data.records || []; |
| | | processParamPage.total = res.data.total || 0; |
| | | }); |
| | | }; |
| | | |
| | | // å é¤å½åå·¥åºç»å®ççäº§è®°å½ |
| | | const handleDeleteProcessParam = () => { |
| | | const ids = processParamSelectedRows.value.map(item => item.id); |
| | | if (!ids.length) { |
| | | proxy.$modal.msgWarning("è¯·éæ©è¦å é¤çè®°å½"); |
| | | return; |
| | | } |
| | | proxy.$modal |
| | | .confirm("æ¯å¦ç¡®è®¤å é¤éä¸çç产记å½ï¼") |
| | | .then(() => delProcessParam(ids)) |
| | | .then(() => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getProcessParamList(); |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | // æå¼éæ©ç产记å½å¼¹æ¡ |
| | | const showSelectProductParamModal = () => { |
| | | isShowSelectParamModal.value = true; |
| | | productParamPage.current = 1; |
| | | getProductParamList(); |
| | | }; |
| | | |
| | | const getProductParamList = () => { |
| | | const params = { |
| | | ...productParamPage, |
| | | }; |
| | | listProductParamPage(params).then(res => { |
| | | const records = res.data.records || []; |
| | | // å·²ç»å®å°å½åå·¥åºçç产记å½ï¼ä¸å
è®¸åæ¬¡éæ© -> æ ¹æ®åæ°ç¼ç æä¸ disabled æ è®° |
| | | const boundCodeSet = new Set( |
| | | (processParamTableData.value || []) |
| | | .map(item => item.code ?? item.parameterCode) |
| | | .filter(code => !!code) |
| | | ); |
| | | productParamTableData.value = records.map(item => ({ |
| | | ...item, |
| | | disabled: item.code ? boundCodeSet.has(item.code) : false, |
| | | })); |
| | | productParamPage.total = res.data.total || 0; |
| | | }); |
| | | }; |
| | | |
| | | // 确认ç»å½åå·¥åºæ°å¢çäº§è®°å½ |
| | | const handleAddProcessParam = () => { |
| | | if (!currentProcess.value) return; |
| | | const selectedList = productParamSelectedRows.value || []; |
| | | if (!selectedList.length) { |
| | | proxy.$modal.msgWarning("è¯·éæ©è¦ç»å®çç产记å½"); |
| | | return; |
| | | } |
| | | // processId æ¾å¨è·¯å¾éï¼body ç´æ¥ä¼ éä¸ççäº§è®°å½æ°ç» |
| | | addProductProcessParameter(currentProcess.value.id, selectedList) |
| | | .then(() => { |
| | | proxy.$modal.msgSuccess("æ°å¢æå"); |
| | | isShowSelectParamModal.value = false; |
| | | getProcessParamList(); |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | // å é¤ |
| | | function handleDelete() { |
| | | const no = selectedRows.value.map(item => item.no); |