| | |
| | | "VITE_APP_TITLE": "è¯å¯¼äºï¼ç®¡çä¿¡æ¯ç³»ç»ï¼" |
| | | }, |
| | | "screen": "screen/PCDZView.png", |
| | | "logo": "logo/PCDZLogo.png", |
| | | "favicon": "favicon/PCDZico.ico" |
| | | "logo": "logo/ZSJCLogo.png", |
| | | "favicon": "favicon/ZSJCLogo.ico" |
| | | }, |
| | | "PCDZ": { |
| | | "ZSJC": { |
| | | "env": { |
| | | "VITE_APP_TITLE": "é¹åçµåä¿¡æ¯ç®¡ç", |
| | | "VITE_BASE_API": "http://1.15.17.182:9003", |
| | | "VITE_JAVA_API": "http://1.15.17.182:9002" |
| | | "VITE_APP_TITLE": "ä¸ç建æä¿¡æ¯ç®¡ç", |
| | | "VITE_BASE_API": "http://1.15.17.182:9019", |
| | | "VITE_JAVA_API": "http://1.15.17.182:9018" |
| | | }, |
| | | "screen": "screen/PCDZView.png", |
| | | "logo": "logo/PCDZLogo.png", |
| | | "favicon": "favicon/PCDZico.ico" |
| | | "logo": "logo/ZSJCLogo.png", |
| | | "favicon": "favicon/ZSJCLogo.ico" |
| | | }, |
| | | "screen": "/src/assets/images/login-background.png", |
| | | "logo": "/src/assets/logo/logo.png", |
| | | "logo": "/src/assets/logo/å®å¤ä¸ç建æç§ææéå
¬å¸.png", |
| | | "favicon": "/public/favicon.ico" |
| | | } |
| | | } |
| | |
| | | params: query |
| | | }) |
| | | } |
| | | // äº§åæ æ¥è¯¢2 |
| | | export function productTreeListQuery(query) { |
| | | return request({ |
| | | url: '/productMaterial/listQuery', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | // 产ååç±»æ°å¢ |
| | | export function addOrEditProduct(query) { |
| | | return request({ |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // åæ°ç»´æ¤é¡µé¢æ¥å£ |
| | | import request from '@/utils/request' |
| | | |
| | | // æ¥è¯¢åæ°å表 |
| | | export function parameterListPage(query) { |
| | | return request({ |
| | | url: '/basic/parameter/listPage', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | |
| | | // æ°å¢åæ° |
| | | export function addParameter(data) { |
| | | return request({ |
| | | url: '/basic/parameter/add', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // ç¼è¾åæ° |
| | | export function updateParameter(data) { |
| | | return request({ |
| | | url: '/basic/parameter/update', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // å é¤åæ° |
| | | export function delParameter(ids) { |
| | | return request({ |
| | | url: '/basic/parameter/del', |
| | | method: 'delete', |
| | | data: Array.isArray(ids) ? ids : [ids] |
| | | }) |
| | | } |
| | | |
| | | // è·å产åç±»åå表 |
| | | export function getProductTypes() { |
| | | return request({ |
| | | url: '/basic/product/typeList', |
| | | method: 'get' |
| | | }) |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title ml10">åæ°åç§°ï¼</span> |
| | | <el-input v-model="searchForm.materialCode" |
| | | style="width: 200px" |
| | | placeholder="请è¾å
¥åæ°åç§°" |
| | | clearable /> |
| | | <span class="search_title ml10">å
³è产åç±»åï¼</span> |
| | | <el-input v-model="searchForm.productName" |
| | | style="width: 200px" |
| | | placeholder="请è¾å
¥å
³è产åç±»å" |
| | | clearable /> |
| | | <el-button type="primary" |
| | | @click="handleQuery" |
| | | style="margin-left: 10px">æç´¢</el-button> |
| | | <el-button @click="handleReset">éç½®</el-button> |
| | | <el-button type="primary" |
| | | @click="handleAdd" |
| | | style="margin-left: 10px">æ°å¢åæ°</el-button> |
| | | <el-button type="primary" |
| | | @click="handleProductTypeMaintenance" |
| | | style="margin-left: 10px">产åç±»åç»´æ¤</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <PIMTable rowKey="materialCode" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | height="calc(100vh - 320px)" |
| | | :tableLoading="tableLoading" |
| | | :isSelection="false" |
| | | @pagination="pagination"> |
| | | </PIMTable> |
| | | </div> |
| | | <!-- æ°å¢/ç¼è¾å¯¹è¯æ¡ --> |
| | | <el-dialog v-model="dialogVisible" |
| | | :title="dialogTitle" |
| | | width="500px"> |
| | | <el-form :model="formData" |
| | | :rules="rules" |
| | | ref="formRef" |
| | | label-width="120px"> |
| | | <el-form-item label="åæ°ç¼å·" |
| | | prop="parameterCode"> |
| | | <el-input v-model="formData.parameterCode" |
| | | placeholder="请è¾å
¥åæ°ç¼å·" /> |
| | | </el-form-item> |
| | | <el-form-item label="åæ°åç§°" |
| | | prop="parameterName"> |
| | | <el-input v-model="formData.parameterName" |
| | | placeholder="请è¾å
¥åæ°åç§°" /> |
| | | </el-form-item> |
| | | <el-form-item label="åæ°æ¨¡å¼" |
| | | prop="parameterFormat"> |
| | | <el-select v-model="formData.parameterType2" |
| | | placeholder="è¯·éæ©åæ°ç±»å"> |
| | | <el-option label="åå¼" |
| | | value="1" /> |
| | | <el-option label="åºé´" |
| | | value="2" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="åæ°ç±»å" |
| | | prop="parameterType"> |
| | | <el-select v-model="formData.parameterType" |
| | | @change="handleParameterTypeChange" |
| | | placeholder="è¯·éæ©åæ°ç±»å"> |
| | | <el-option label="æ°å¼æ ¼å¼" |
| | | value="æ°å¼æ ¼å¼" /> |
| | | <el-option label="ææ¬æ ¼å¼" |
| | | value="ææ¬æ ¼å¼" /> |
| | | <el-option label="䏿é项" |
| | | value="䏿é项" /> |
| | | <el-option label="æ¶é´æ ¼å¼" |
| | | value="æ¶é´æ ¼å¼" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item v-if="formData.parameterType === '䏿é项'" |
| | | label="æ°æ®åå
¸" |
| | | prop="parameterFormat"> |
| | | <el-select v-model="formData.parameterFormat" |
| | | placeholder="è¯·éæ©æ°æ®åå
¸"> |
| | | <el-option v-for="item in dictTypes" |
| | | :key="item.dictType" |
| | | :label="item.dictName" |
| | | :value="item.dictType" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item v-else-if="formData.parameterType === 'æ¶é´æ ¼å¼'" |
| | | label="æ¶é´æ ¼å¼" |
| | | prop="parameterFormat"> |
| | | <el-select v-model="formData.parameterFormat" |
| | | placeholder="è¯·éæ©æ¶é´æ ¼å¼"> |
| | | <el-option label="YYYY-MM-DD HH:mm:ss" |
| | | value="YYYY-MM-DD HH:mm:ss" /> |
| | | <el-option label="YYYY-MM-DD" |
| | | value="YYYY-MM-DD" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item v-else |
| | | label="åæ°æ ¼å¼" |
| | | prop="parameterFormat"> |
| | | <el-input v-model="formData.parameterFormat" |
| | | placeholder="请è¾å
¥åæ°æ ¼å¼" /> |
| | | </el-form-item> |
| | | <el-form-item label="å
³è产åç±»å" |
| | | prop="parameterValue"> |
| | | <el-select v-model="formData.parameterValue" |
| | | placeholder="è¯·éæ©å
³è产åç±»å"> |
| | | <el-option v-for="item in productTypes" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="æ åå¼" |
| | | v-if="formData.parameterType2 === '1'" |
| | | prop="standardValue"> |
| | | <el-input v-model="formData.standardValue" |
| | | placeholder="请è¾å
¥æ åå¼" /> |
| | | </el-form-item> |
| | | <el-form-item label="æå¤§å¼" |
| | | v-if="formData.parameterType2 === '2'" |
| | | prop="standardValue"> |
| | | <el-input v-model="formData.standardValue" |
| | | placeholder="请è¾å
¥æ åå¼" /> |
| | | </el-form-item> |
| | | <el-form-item label="æå°å¼" |
| | | v-if="formData.parameterType2 === '2'" |
| | | prop="standardValue"> |
| | | <el-input v-model="formData.standardValue" |
| | | placeholder="请è¾å
¥æ åå¼" /> |
| | | </el-form-item> |
| | | <el-form-item label="åä½" |
| | | prop="unit"> |
| | | <el-input v-model="formData.unit" |
| | | placeholder="请è¾å
¥åä½" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="dialogVisible = false">åæ¶</el-button> |
| | | <el-button type="primary" |
| | | @click="handleSubmit">ç¡®å®</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | <!-- 产åç±»åç»´æ¤å¯¹è¯æ¡ --> |
| | | <el-dialog v-model="productTypeDialogVisible" |
| | | title="产åç±»åç»´æ¤" |
| | | width="600px"> |
| | | <div class="product-type-header"> |
| | | <el-button type="primary" |
| | | @click="handleAddProductType">æ°å¢äº§åç±»å</el-button> |
| | | </div> |
| | | <el-table :data="productTypeList" |
| | | border |
| | | style="width: 100%; margin-top: 10px; margin-bottom: 20px"> |
| | | <!-- <el-table-column prop="typeCode" |
| | | label="ç±»åç¼ç " |
| | | width="150" /> --> |
| | | <el-table-column prop="typeName" |
| | | label="ç±»ååç§°" /> |
| | | <el-table-column label="æä½" |
| | | width="150"> |
| | | <template #default="scope"> |
| | | <el-button link |
| | | type="primary" |
| | | @click="handleEditProductType(scope.row)">ç¼è¾</el-button> |
| | | <el-button link |
| | | type="danger" |
| | | @click="handleDeleteProductType(scope.row)">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-dialog> |
| | | <!-- æ°å¢/ç¼è¾äº§åç±»åå¯¹è¯æ¡ --> |
| | | <el-dialog v-model="productTypeFormVisible" |
| | | :title="productTypeDialogTitle" |
| | | width="400px"> |
| | | <el-form :model="productTypeForm" |
| | | :rules="productTypeRules" |
| | | ref="productTypeFormRef" |
| | | label-width="100px"> |
| | | <!-- <el-form-item label="ç±»åç¼ç " |
| | | prop="typeCode"> |
| | | <el-input v-model="productTypeForm.typeCode" |
| | | placeholder="请è¾å
¥ç±»åç¼ç " /> |
| | | </el-form-item> --> |
| | | <el-form-item label="ç±»ååç§°" |
| | | prop="typeName"> |
| | | <el-input v-model="productTypeForm.typeName" |
| | | placeholder="请è¾å
¥ç±»ååç§°" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="productTypeFormVisible = false">åæ¶</el-button> |
| | | <el-button type="primary" |
| | | @click="handleProductTypeSubmit">ç¡®å®</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, ref, reactive } from "vue"; |
| | | import { |
| | | parameterListPage, |
| | | addParameter, |
| | | updateParameter, |
| | | delParameter, |
| | | getProductTypes as getProductTypesApi, |
| | | } from "@/api/basicData/parameterMaintenance.js"; |
| | | import { listType } from "@/api/system/dict/type"; |
| | | import PIMTable from "@/components/PIMTable/PIMTable.vue"; |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | | |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "åæ°ç¼å·", |
| | | prop: "parameterCode", |
| | | className: "code-cell", |
| | | }, |
| | | { |
| | | label: "åæ°åç§°", |
| | | prop: "parameterName", |
| | | }, |
| | | { |
| | | label: "åæ°æ¨¡å¼", |
| | | prop: "parameterType2", |
| | | }, |
| | | { |
| | | label: "åæ°ç±»å", |
| | | prop: "parameterType", |
| | | dataType: "tag", |
| | | formatType: params => { |
| | | const typeMap = { |
| | | æ°å¼æ ¼å¼: "primary", |
| | | ææ¬æ ¼å¼: "info", |
| | | 䏿é项: "warning", |
| | | æ¶é´æ ¼å¼: "success", |
| | | }; |
| | | return typeMap[params] || "default"; |
| | | }, |
| | | }, |
| | | { |
| | | label: "åæ°æ ¼å¼", |
| | | prop: "parameterFormat", |
| | | }, |
| | | { |
| | | label: "å
³è产åç±»å", |
| | | prop: "parameterValue", |
| | | }, |
| | | { |
| | | label: "æ åå¼", |
| | | prop: "standardValue", |
| | | className: row => { |
| | | return row.parameterType == "æ°å¼æ ¼å¼" ? "quantity-cell" : ""; |
| | | }, |
| | | }, |
| | | { |
| | | label: "æå¤§å¼", |
| | | prop: "standardValue", |
| | | className: row => { |
| | | return row.parameterType == "æ°å¼æ ¼å¼" ? "quantity-cell" : ""; |
| | | }, |
| | | }, |
| | | { |
| | | label: "æå°å¼", |
| | | prop: "standardValue", |
| | | className: row => { |
| | | return row.parameterType == "æ°å¼æ ¼å¼" ? "quantity-cell" : ""; |
| | | }, |
| | | }, |
| | | { |
| | | label: "åä½", |
| | | prop: "unit", |
| | | }, |
| | | { |
| | | label: "æä½", |
| | | dataType: "action", |
| | | width: "150", |
| | | operation: [ |
| | | { |
| | | name: "ç¼è¾", |
| | | clickFun: row => { |
| | | handleEdit(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: "å é¤", |
| | | clickFun: row => { |
| | | handleDelete(row); |
| | | }, |
| | | }, |
| | | ], |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 10, |
| | | total: 0, |
| | | }); |
| | | |
| | | // æç´¢è¡¨å |
| | | const searchForm = reactive({ |
| | | materialCode: "", |
| | | productName: "", |
| | | }); |
| | | |
| | | // å¯¹è¯æ¡ç¸å
³ |
| | | const dialogVisible = ref(false); |
| | | const dialogTitle = ref(""); |
| | | const formRef = ref(null); |
| | | const formData = reactive({ |
| | | parameterCode: "", |
| | | parameterName: "", |
| | | parameterType2: "1", |
| | | parameterType: "", |
| | | parameterFormat: "", |
| | | parameterValue: "", |
| | | standardValue: "", |
| | | unit: "", |
| | | }); |
| | | const rules = reactive({ |
| | | parameterCode: [ |
| | | { required: true, message: "请è¾å
¥åæ°ç¼å·", trigger: "blur" }, |
| | | ], |
| | | parameterName: [ |
| | | { required: true, message: "请è¾å
¥åæ°åç§°", trigger: "blur" }, |
| | | ], |
| | | parameterType: [ |
| | | { required: true, message: "è¯·éæ©åæ°ç±»å", trigger: "change" }, |
| | | ], |
| | | parameterFormat: [ |
| | | { required: true, message: "è¯·éæ©åæ°æ ¼å¼", trigger: "change" }, |
| | | ], |
| | | parameterValue: [ |
| | | { required: true, message: "è¯·éæ©å
³è产åç±»å", trigger: "change" }, |
| | | ], |
| | | standardValue: [{ required: true, message: "请è¾å
¥æ åå¼", trigger: "blur" }], |
| | | unit: [{ required: true, message: "请è¾å
¥åä½", trigger: "blur" }], |
| | | }); |
| | | const productTypes = ref([]); |
| | | const isEdit = ref(false); |
| | | |
| | | // 产åç±»åç»´æ¤ç¸å
³ |
| | | const productTypeDialogVisible = ref(false); |
| | | const productTypeFormVisible = ref(false); |
| | | const productTypeDialogTitle = ref(""); |
| | | const productTypeFormRef = ref(null); |
| | | const productTypeList = ref([]); |
| | | const productTypeForm = reactive({ |
| | | id: null, |
| | | // typeCode: "", |
| | | typeName: "", |
| | | }); |
| | | const productTypeRules = reactive({ |
| | | // typeCode: [{ required: true, message: "请è¾å
¥ç±»åç¼ç ", trigger: "blur" }], |
| | | typeName: [{ required: true, message: "请è¾å
¥ç±»ååç§°", trigger: "blur" }], |
| | | }); |
| | | const isProductTypeEdit = ref(false); |
| | | const handleParameterTypeChange = () => { |
| | | if (formData.parameterType === "æ°å¼æ ¼å¼") { |
| | | formData.parameterFormat = "#.0000"; |
| | | } else if (formData.parameterType === "æ¶é´æ ¼å¼") { |
| | | formData.parameterFormat = "YYYY-MM-DD HH:mm:ss"; |
| | | } else { |
| | | formData.parameterFormat = ""; |
| | | } |
| | | }; |
| | | // 产åç±»åç»´æ¤æé®ç¹å»äºä»¶ |
| | | const handleProductTypeMaintenance = () => { |
| | | productTypeDialogVisible.value = true; |
| | | getProductTypeList(); |
| | | }; |
| | | |
| | | // è·å产åç±»åå表 |
| | | const getProductTypeList = () => { |
| | | productTypeList.value = [ |
| | | { id: 1, typeCode: "TYPE001", typeName: "3.5ç å" }, |
| | | { id: 2, typeCode: "TYPE002", typeName: "5.0ç å" }, |
| | | { id: 3, typeCode: "TYPE003", typeName: "æ¿æ" }, |
| | | ]; |
| | | }; |
| | | |
| | | // æ°å¢äº§åç±»å |
| | | const handleAddProductType = () => { |
| | | isProductTypeEdit.value = false; |
| | | productTypeDialogTitle.value = "æ°å¢äº§åç±»å"; |
| | | productTypeForm.id = null; |
| | | productTypeForm.typeCode = ""; |
| | | productTypeForm.typeName = ""; |
| | | productTypeFormVisible.value = true; |
| | | }; |
| | | |
| | | // ç¼è¾äº§åç±»å |
| | | const handleEditProductType = row => { |
| | | isProductTypeEdit.value = true; |
| | | productTypeDialogTitle.value = "ç¼è¾äº§åç±»å"; |
| | | productTypeForm.id = row.id; |
| | | productTypeForm.typeCode = row.typeCode; |
| | | productTypeForm.typeName = row.typeName; |
| | | productTypeFormVisible.value = true; |
| | | }; |
| | | |
| | | // å é¤äº§åç±»å |
| | | const handleDeleteProductType = row => { |
| | | ElMessageBox.confirm("ç¡®å®è¦å é¤è¯¥äº§åç±»ååï¼", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | ElMessage.success("å 餿å"); |
| | | getProductTypeList(); |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | // æäº¤äº§åç±»å表å |
| | | const handleProductTypeSubmit = () => { |
| | | productTypeFormRef.value.validate(valid => { |
| | | if (valid) { |
| | | ElMessage.success(isProductTypeEdit.value ? "ç¼è¾æå" : "æ°å¢æå"); |
| | | productTypeFormVisible.value = false; |
| | | getProductTypeList(); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | |
| | | /** éç½®æé®æä½ */ |
| | | const handleReset = () => { |
| | | searchForm.materialCode = ""; |
| | | searchForm.productName = ""; |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const pagination = obj => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | // 注éæAPIè°ç¨ï¼ä½¿ç¨åæ°æ® |
| | | /*const params = { ...searchForm, ...page }; |
| | | parameterListPage(params) |
| | | .then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data; |
| | | page.total = res.total || 0; |
| | | }) |
| | | .catch(() => { |
| | | tableLoading.value = false; |
| | | });*/ |
| | | |
| | | // åæ°æ® |
| | | setTimeout(() => { |
| | | tableLoading.value = false; |
| | | tableData.value = [ |
| | | { |
| | | id: 1, |
| | | parameterCode: "PARAM001", |
| | | parameterName: "é¿åº¦", |
| | | parameterType2: "1", |
| | | parameterType: "æ°å¼æ ¼å¼", |
| | | parameterFormat: "", |
| | | parameterValue: "type1", |
| | | standardValue: "100", |
| | | unit: "mm", |
| | | }, |
| | | { |
| | | id: 2, |
| | | parameterCode: "PARAM002", |
| | | parameterName: "温度", |
| | | parameterType2: "2", |
| | | parameterType: "æ°å¼æ ¼å¼", |
| | | parameterFormat: "", |
| | | parameterValue: "type1", |
| | | standardValue: "25", |
| | | unit: "â", |
| | | }, |
| | | { |
| | | id: 3, |
| | | parameterCode: "PARAM003", |
| | | parameterName: "é¢è²", |
| | | parameterType2: "1", |
| | | parameterType: "ææ¬æ ¼å¼", |
| | | parameterFormat: "", |
| | | parameterValue: "type2", |
| | | standardValue: "红è²", |
| | | unit: "", |
| | | }, |
| | | { |
| | | id: 4, |
| | | parameterCode: "PARAM004", |
| | | parameterName: "ç¶æ", |
| | | parameterType2: "1", |
| | | parameterType: "䏿é项", |
| | | parameterFormat: "status", |
| | | parameterValue: "type3", |
| | | standardValue: "æ£å¸¸", |
| | | unit: "", |
| | | }, |
| | | { |
| | | id: 5, |
| | | parameterCode: "PARAM005", |
| | | parameterName: "å建æ¶é´", |
| | | parameterType2: "1", |
| | | parameterType: "æ¶é´æ ¼å¼", |
| | | parameterFormat: "YYYY-MM-DD HH:mm:ss", |
| | | parameterValue: "type2", |
| | | standardValue: "2024-01-01 00:00:00", |
| | | unit: "", |
| | | }, |
| | | ]; |
| | | page.total = 5; |
| | | }, 500); |
| | | }; |
| | | |
| | | // è·å产åç±»åå表 |
| | | const getProductTypes = () => { |
| | | // 注éæAPIè°ç¨ï¼ä½¿ç¨åæ°æ® |
| | | /*getProductTypesApi() |
| | | .then(res => { |
| | | productTypes.value = res.data || []; |
| | | }) |
| | | .catch(() => { |
| | | // 失败æ¶ä½¿ç¨æ¨¡ææ°æ® |
| | | productTypes.value = [ |
| | | { label: "3.5ç å", value: "type1" }, |
| | | { label: "5.0ç å", value: "type2" }, |
| | | { label: "æ¿æ", value: "type3" }, |
| | | ]; |
| | | });*/ |
| | | |
| | | // åæ°æ® |
| | | productTypes.value = [ |
| | | { label: "3.5ç å", value: "type1" }, |
| | | { label: "5.0ç å", value: "type2" }, |
| | | { label: "æ¿æ", value: "type3" }, |
| | | ]; |
| | | }; |
| | | |
| | | // æ°å¢æé®ç¹å»äºä»¶ |
| | | const handleAdd = () => { |
| | | isEdit.value = false; |
| | | dialogTitle.value = "æ°å¢åæ°"; |
| | | // é置表å |
| | | formData.parameterCode = ""; |
| | | formData.parameterName = ""; |
| | | formData.parameterType2 = "1"; |
| | | formData.parameterType = ""; |
| | | formData.parameterFormat = ""; |
| | | formData.parameterValue = ""; |
| | | formData.standardValue = ""; |
| | | formData.unit = ""; |
| | | dialogVisible.value = true; |
| | | }; |
| | | |
| | | // ç¼è¾æé®ç¹å»äºä»¶ |
| | | const handleEdit = row => { |
| | | isEdit.value = true; |
| | | dialogTitle.value = "ç¼è¾åæ°"; |
| | | // å¡«å
è¡¨åæ°æ® |
| | | formData.parameterCode = row.parameterCode; |
| | | formData.parameterName = row.parameterName; |
| | | formData.parameterType2 = row.parameterType2 || "1"; |
| | | formData.parameterType = row.parameterType; |
| | | formData.parameterFormat = row.parameterFormat; |
| | | formData.parameterValue = row.parameterValue; |
| | | formData.standardValue = row.standardValue; |
| | | formData.unit = row.unit; |
| | | dialogVisible.value = true; |
| | | }; |
| | | |
| | | // å 餿é®ç¹å»äºä»¶ |
| | | const handleDelete = row => { |
| | | ElMessageBox.confirm("ç¡®å®è¦å é¤è¿æ¡æ°æ®åï¼", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | // 注éæAPIè°ç¨ï¼ä½¿ç¨åæ°æ® |
| | | /*delParameter(row.id) |
| | | .then(res => { |
| | | ElMessage.success("å 餿å"); |
| | | getList(); |
| | | }) |
| | | .catch(() => { |
| | | ElMessage.error("å é¤å¤±è´¥"); |
| | | });*/ |
| | | |
| | | // åæ°æ®æ¨¡æ |
| | | ElMessage.success("å 餿å"); |
| | | getList(); |
| | | }) |
| | | .catch(() => { |
| | | // åæ¶å é¤ |
| | | }); |
| | | }; |
| | | |
| | | // æäº¤è¡¨å |
| | | const handleSubmit = () => { |
| | | formRef.value.validate(valid => { |
| | | if (valid) { |
| | | // 注éæAPIè°ç¨ï¼ä½¿ç¨åæ°æ® |
| | | /*const api = isEdit.value ? updateParameter : addParameter; |
| | | api(formData) |
| | | .then(res => { |
| | | ElMessage.success(isEdit.value ? "ç¼è¾æå" : "æ°å¢æå"); |
| | | dialogVisible.value = false; |
| | | getList(); |
| | | }) |
| | | .catch(() => { |
| | | ElMessage.error(isEdit.value ? "ç¼è¾å¤±è´¥" : "æ°å¢å¤±è´¥"); |
| | | });*/ |
| | | |
| | | // åæ°æ®æ¨¡æ |
| | | ElMessage.success(isEdit.value ? "ç¼è¾æå" : "æ°å¢æå"); |
| | | dialogVisible.value = false; |
| | | getList(); |
| | | } else { |
| | | return false; |
| | | } |
| | | }); |
| | | }; |
| | | const dictTypes = ref([]); |
| | | const getDictTypes = () => { |
| | | listType({ pageNum: 1, pageSize: 1000 }).then(res => { |
| | | dictTypes.value = res.rows || []; |
| | | }); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getDictTypes(); |
| | | getList(); |
| | | getProductTypes(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .app-container { |
| | | padding: 24px; |
| | | background-color: #f0f2f5; |
| | | min-height: calc(100vh - 48px); |
| | | } |
| | | |
| | | .search_form { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | margin-bottom: 24px; |
| | | padding: 20px; |
| | | background-color: #ffffff; |
| | | border-radius: 6px; |
| | | box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05); |
| | | transition: all 0.3s ease; |
| | | |
| | | &:hover { |
| | | box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.08); |
| | | } |
| | | |
| | | .search_title { |
| | | color: #606266; |
| | | font-size: 14px; |
| | | font-weight: 500; |
| | | } |
| | | |
| | | .ml10 { |
| | | margin-left: 10px; |
| | | } |
| | | } |
| | | |
| | | .table_list { |
| | | background-color: #ffffff; |
| | | border-radius: 6px; |
| | | box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05); |
| | | overflow: hidden; |
| | | height: calc(100vh - 230px); |
| | | } |
| | | |
| | | :deep(.el-table) { |
| | | border: none; |
| | | border-radius: 6px; |
| | | overflow: hidden; |
| | | box-shadow: 0 4px 16px rgba(102, 126, 234, 0.1); |
| | | |
| | | .el-table__header-wrapper { |
| | | background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); |
| | | |
| | | th { |
| | | background: transparent; |
| | | font-weight: 600; |
| | | // color: #ffffff; |
| | | border-bottom: none; |
| | | padding: 16px 0; |
| | | letter-spacing: 0.5px; |
| | | } |
| | | } |
| | | |
| | | .el-table__body-wrapper { |
| | | tr { |
| | | transition: all 0.3s ease; |
| | | |
| | | &:hover { |
| | | background: linear-gradient( |
| | | 90deg, |
| | | rgba(102, 126, 234, 0.05) 0%, |
| | | rgba(118, 75, 162, 0.05) 100% |
| | | ); |
| | | transform: scale(1.002); |
| | | box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1); |
| | | } |
| | | |
| | | td { |
| | | border-bottom: 1px solid #f0f0f0; |
| | | padding: 14px 0; |
| | | color: #303133; |
| | | } |
| | | } |
| | | |
| | | tr.current-row { |
| | | background: linear-gradient( |
| | | 90deg, |
| | | rgba(102, 126, 234, 0.08) 0%, |
| | | rgba(118, 75, 162, 0.08) 100% |
| | | ); |
| | | } |
| | | |
| | | // æ°å¼åæ®µæ ·å¼ |
| | | .quantity-cell, |
| | | .volume-cell, |
| | | .dimension-cell { |
| | | font-weight: 600; |
| | | color: #409eff; |
| | | font-family: "Courier New", monospace; |
| | | text-shadow: 0 1px 2px rgba(64, 158, 255, 0.2); |
| | | } |
| | | |
| | | // è§æ ¼åæ®µæ ·å¼ |
| | | .spec-cell { |
| | | color: #67c23a; |
| | | font-weight: 500; |
| | | padding: 4px 8px; |
| | | border-radius: 4px; |
| | | } |
| | | |
| | | // ç¼ç åæ®µæ ·å¼ |
| | | .code-cell { |
| | | color: #e6a23c; |
| | | font-family: "Courier New", monospace; |
| | | font-weight: 500; |
| | | padding: 4px 8px; |
| | | border-radius: 4px; |
| | | } |
| | | |
| | | // æ¥æåæ®µæ ·å¼ |
| | | .date-cell { |
| | | color: #909399; |
| | | font-style: italic; |
| | | } |
| | | } |
| | | |
| | | .el-table__empty-block { |
| | | padding: 60px 0; |
| | | background-color: #fafafa; |
| | | } |
| | | } |
| | | |
| | | .pagination-container { |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | padding: 16px 20px; |
| | | background-color: #ffffff; |
| | | border-top: 1px solid #ebeef5; |
| | | border-radius: 0 0 12px 12px; |
| | | } |
| | | |
| | | :deep(.el-button) { |
| | | transition: all 0.3s ease; |
| | | |
| | | &:hover { |
| | | transform: translateY(-1px); |
| | | } |
| | | } |
| | | |
| | | @media (max-width: 768px) { |
| | | .app-container { |
| | | padding: 16px; |
| | | } |
| | | |
| | | .search_form { |
| | | flex-direction: column; |
| | | align-items: flex-start; |
| | | gap: 12px; |
| | | |
| | | .el-form { |
| | | width: 100%; |
| | | |
| | | .el-form-item { |
| | | width: 100%; |
| | | } |
| | | } |
| | | |
| | | .el-button { |
| | | margin-right: 12px; |
| | | } |
| | | } |
| | | |
| | | :deep(.el-table) { |
| | | th, |
| | | td { |
| | | padding: 10px 0; |
| | | font-size: 12px; |
| | | } |
| | | } |
| | | } |
| | | </style> |
| | |
| | | style="width: 210px" |
| | | placeholder="è¾å
¥å
³é®åè¿è¡æç´¢" |
| | | @change="searchFilter" |
| | | @clear="searchFilter" |
| | | @clear="searchFilter1" |
| | | clearable |
| | | prefix-icon="Search" /> |
| | | <el-button type="primary" |
| | |
| | | <div class="custom-tree-node"> |
| | | <span class="tree-node-content"> |
| | | <el-icon class="tree-icon"> |
| | | <component :is="data.children && data.children.length > 0 |
| | | ? node.expanded ? 'FolderOpened' : 'Folder' : 'Tickets'" /> |
| | | <component :is="node.expanded ? 'FolderOpened' : 'Folder'" /> |
| | | </el-icon> |
| | | <span class="tree-node-label">{{ data.label }}</span> |
| | | </span> |
| | |
| | | </div> |
| | | </div> |
| | | <div class="right"> |
| | | <div style="margin-bottom: 10px" |
| | | <div style="margin-bottom: 10px; display: flex; align-items: center; gap: 10px" |
| | | v-if="isShowButton"> |
| | | <el-button type="primary" |
| | | @click="openModelDia('add')"> |
| | |
| | | </el-button> |
| | | <ImportExcel :product-id="currentId" |
| | | @uploadSuccess="getModelList" /> |
| | | <el-input v-model="specification" |
| | | placeholder="è§æ ¼åå·" |
| | | style="width: 150px" |
| | | clearable |
| | | @change="getModelList" /> |
| | | <el-input v-model="materialCode" |
| | | placeholder="ç©æç¼å·" |
| | | style="width: 150px" |
| | | clearable |
| | | @change="getModelList" /> |
| | | <el-button type="danger" |
| | | @click="handleDelete" |
| | | style="margin-left: 10px" |
| | | plain> |
| | | å é¤ |
| | | </el-button> |
| | |
| | | <PIMTable rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | :isShowPagination="false" |
| | | @selection-change="handleSelectionChange" |
| | | :tableLoading="tableLoading"></PIMTable> |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination"></PIMTable> |
| | | </div> |
| | | <el-dialog v-model="productDia" |
| | | title="产å" |
| | |
| | | <el-select v-model="form.inventoryCategoryId" |
| | | placeholder="è¯·éæ©åè´§ç±»å«" |
| | | clearable |
| | | filterable |
| | | style="width: 100%"> |
| | | <el-option v-for="item in inventoryCategoryList" |
| | | :key="item.id" |
| | |
| | | <el-select v-model="form.materialTypeId" |
| | | placeholder="è¯·éæ©ç©æç±»å" |
| | | clearable |
| | | filterable |
| | | style="width: 100%"> |
| | | <el-option v-for="item in materialTypeList" |
| | | :key="item.id" |
| | |
| | | @keydown.enter.prevent /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="ç©æç¼ç ï¼" |
| | | prop="materialCode"> |
| | | <el-input v-model="modelForm.materialCode" |
| | | placeholder="请è¾å
¥ç©æç¼ç " |
| | | clearable |
| | | @keydown.enter.prevent /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | |
| | | <el-select v-model="modelForm.supplyType" |
| | | placeholder="è¯·éæ©ä¾åºæ¹å¼" |
| | | clearable |
| | | filterable |
| | | style="width: 100%"> |
| | | <el-option label="èªå¶" |
| | | value="èªå¶" /> |
| | |
| | | delProductModel, |
| | | modelListPage, |
| | | productTreeList, |
| | | productTreeListQuery, |
| | | addOrEditProductConfig, |
| | | updateOrEditProductConfig, |
| | | delProductConfig, |
| | |
| | | const expandedKeys = ref([]); |
| | | const inventoryCategoryList = ref([]); |
| | | const materialTypeList = ref([]); |
| | | const specification = ref(""); |
| | | const materialCode = ref(""); |
| | | |
| | | const getloadData = () => { |
| | | loadData() |
| | |
| | | prop: "specification", |
| | | }, |
| | | { |
| | | label: "ç©æç¼ç ", |
| | | prop: "materialCode", |
| | | }, |
| | | { |
| | | label: "åä½", |
| | | prop: "baseUnit", |
| | | }, |
| | |
| | | const tableLoading = ref(false); |
| | | const isShowButton = ref(false); |
| | | const selectedRows = ref([]); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 10, |
| | | total: 0, |
| | | }); |
| | | |
| | | const data = reactive({ |
| | | form: { |
| | |
| | | modelForm: { |
| | | specification: "", |
| | | supplyType: "", |
| | | materialCode: "", |
| | | id: null, |
| | | }, |
| | | modelRules: { |
| | | specification: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | supplyType: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | materialCode: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | }, |
| | | configForm: { |
| | | configName: "", |
| | |
| | | // æ¥è¯¢äº§åæ |
| | | const getProductTreeList = () => { |
| | | treeLoad.value = true; |
| | | productTreeList() |
| | | productTreeList({ type: 2 }) |
| | | .then(res => { |
| | | // è½¬æ¢æ°çæ°æ®æ ¼å¼ |
| | | const newList = []; |
| | | expandedKeys.value = []; |
| | | for (const category of res.data) { |
| | | // æ·»å åç±»èç¹ |
| | | // æ·»å åç±»èç¹ï¼åªè¿åä¸å±æ°æ®ï¼ä¸å
å«åèç¹ï¼ |
| | | const categoryNode = { |
| | | label: category.configName, |
| | | id: category.configId, |
| | | isLeaf: false, |
| | | children: category.materialList.map(item => ({ |
| | | id: item.id, |
| | | isLeaf: true, |
| | | label: item.materialName, |
| | | inventoryCategoryId: item.inventoryCategoryId, |
| | | materialTypeId: item.materialTypeId, |
| | | remark: item.remark, |
| | | baseUnit: item.baseUnit, |
| | | })), |
| | | children: [], // åå§å为空æ°ç»ï¼ç¹å»æ¶åå è½½ |
| | | }; |
| | | newList.push(categoryNode); |
| | | expandedKeys.value.push(category.configName); |
| | | } |
| | | list.value = newList; |
| | | treeLoad.value = false; |
| | |
| | | treeLoad.value = false; |
| | | }); |
| | | }; |
| | | const searchFilter1 = () => { |
| | | getProductTreeList(); |
| | | }; |
| | | // è¿æ»¤äº§åæ |
| | | const searchFilter = () => { |
| | | proxy.$refs.tree.filter(search.value); |
| | | if (!search.value) { |
| | | // 妿æç´¢å
³é®å为空ï¼éæ°å è½½åå§æ°æ® |
| | | // getProductTreeList(); |
| | | return; |
| | | } |
| | | |
| | | treeLoad.value = true; |
| | | // è°ç¨ productTreeListQuery æ¥å£è¿è¡æç´¢ |
| | | productTreeListQuery({ materialName: search.value }) |
| | | .then(res => { |
| | | // å¤çè¿åçæ°æ® |
| | | const newList = []; |
| | | if (res.data && res.data.length > 0) { |
| | | for (const category of res.data) { |
| | | for (const item of list.value) { |
| | | if (item.id == category.configId) { |
| | | item.children = (category.materialList || []).map(item => ({ |
| | | id: item.id, |
| | | isLeaf: true, |
| | | label: item.materialName, |
| | | inventoryCategoryId: item.inventoryCategoryId, |
| | | materialTypeId: item.materialTypeId, |
| | | remark: item.remark, |
| | | baseUnit: item.baseUnit, |
| | | })); |
| | | break; |
| | | } |
| | | } |
| | | // è½¬æ¢æ°æ®æ ¼å¼ |
| | | // const categoryNode = { |
| | | // label: category.configName, |
| | | // id: category.configId, |
| | | // isLeaf: false, |
| | | // children: (category.materialList || []).map(item => ({ |
| | | // id: item.id, |
| | | // isLeaf: true, |
| | | // label: item.materialName, |
| | | // inventoryCategoryId: item.inventoryCategoryId, |
| | | // materialTypeId: item.materialTypeId, |
| | | // remark: item.remark, |
| | | // baseUnit: item.baseUnit, |
| | | // })), |
| | | // }; |
| | | // newList.push(categoryNode); |
| | | } |
| | | } |
| | | // ä½¿ç¨ el-tree çå
ç½®è¿æ»¤åè½æç´¢ |
| | | proxy.$refs.tree.filter(search.value); |
| | | treeLoad.value = false; |
| | | }) |
| | | .catch(err => { |
| | | treeLoad.value = false; |
| | | }); |
| | | }; |
| | | // æå¼äº§åå¼¹æ¡ |
| | | const openProDia = (type, data) => { |
| | |
| | | modelForm.value.specification = ""; |
| | | modelForm.value.supplyType = ""; |
| | | modelForm.value.id = null; |
| | | modelForm.value.materialCode = null; |
| | | |
| | | if (type === "edit" && data) { |
| | | // ç¼è¾æ¨¡å¼ï¼åå¡«æ°æ® |
| | | modelForm.value.specification = data.specification || ""; |
| | | modelForm.value.supplyType = data.supplyType || ""; |
| | | modelForm.value.id = data.skuId || null; |
| | | modelForm.value.materialCode = data.materialCode || null; |
| | | } |
| | | }; |
| | | // æäº¤äº§ååç§°ä¿®æ¹ |
| | |
| | | }; |
| | | // éæ©äº§å |
| | | const handleNodeClick = (val, node, el) => { |
| | | // ç¹å»éå¶åèç¹æ¶ï¼ä¸æ§è¡ä»¥ä¸é»è¾ |
| | | // ç¹å»éå¶åèç¹æ¶ï¼å è½½åèç¹æ°æ® |
| | | if (!val.isLeaf) { |
| | | // è°ç¨ productTreeListQuery æ¥å£è·ååèç¹æ°æ® |
| | | // treeLoad.value = true; |
| | | productTreeListQuery({ materialTypeId: val.id }) |
| | | .then(res => { |
| | | // å¤çè¿åçæ°æ® |
| | | if (res.data && res.data.length > 0) { |
| | | const materialList = res.data[0].materialList || []; |
| | | // 转æ¢åèç¹æ°æ®æ ¼å¼ |
| | | const children = materialList.map(item => ({ |
| | | id: item.id, |
| | | isLeaf: true, |
| | | label: item.materialName, |
| | | inventoryCategoryId: item.inventoryCategoryId, |
| | | materialTypeId: item.materialTypeId, |
| | | remark: item.remark, |
| | | baseUnit: item.baseUnit, |
| | | })); |
| | | // æ´æ°èç¹çåèç¹ |
| | | val.children = children; |
| | | // å±å¼èç¹ |
| | | node.expanded = true; |
| | | } |
| | | // treeLoad.value = false; |
| | | }) |
| | | .catch(err => { |
| | | // treeLoad.value = false; |
| | | }); |
| | | return; |
| | | } |
| | | // 夿æ¯å¦ä¸ºå¶åèç¹ |
| | |
| | | const params = { |
| | | materialId: currentId.value, |
| | | specification: modelForm.value.specification, |
| | | materialCode: modelForm.value.materialCode, |
| | | supplyType: modelForm.value.supplyType, |
| | | }; |
| | | if (modelOperationType.value === "add") { |
| | |
| | | }; |
| | | |
| | | // æ¥è¯¢è§æ ¼åå· |
| | | const pagination = obj => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getModelList(); |
| | | }; |
| | | const getModelList = () => { |
| | | if (!currentId.value) { |
| | | return; |
| | |
| | | tableLoading.value = true; |
| | | modelListPage({ |
| | | materialId: currentId.value, |
| | | current: page.current, |
| | | size: page.size, |
| | | specification: specification.value, |
| | | materialCode: materialCode.value, |
| | | }).then(res => { |
| | | console.log("res", res); |
| | | tableData.value = res.data; |
| | | tableData.value = res.data.records || []; |
| | | page.total = res.data.total; |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | |
| | | label="åºå·" |
| | | width="60" |
| | | align="center" /> |
| | | <el-table-column prop="timePeriod" |
| | | :label="timeColumnLabel" |
| | | align="center" /> |
| | | <el-table-column prop="meterReadingDate" |
| | | label="æ¥æ" |
| | | align="right"> |
| | | <template #default="scope"> |
| | | <span class="consumption-value">{{ scope.row.meterReadingDate }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="waterConsumption" |
| | | label="ç¨æ°´é(å¨)" |
| | | align="right"> |
| | |
| | | <span class="consumption-value">{{ scope.row.waterConsumption }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="waterAmount" |
| | | <el-table-column prop="waterCost" |
| | | label="æ°´è´¹(å
)" |
| | | align="right"> |
| | | <template #default="scope"> |
| | | <span class="amount-value">{{ scope.row.waterAmount }}</span> |
| | | <span class="amount-value">{{ scope.row.waterCost }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="electricityConsumption" |
| | |
| | | <span class="consumption-value">{{ scope.row.electricityConsumption }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="electricityAmount" |
| | | <el-table-column prop="electricityCost" |
| | | label="çµè´¹(å
)" |
| | | align="right"> |
| | | <template #default="scope"> |
| | | <span class="amount-value">{{ scope.row.electricityAmount }}</span> |
| | | <span class="amount-value">{{ scope.row.electricityCost }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="gasConsumption" |
| | |
| | | <span class="consumption-value">{{ scope.row.gasConsumption }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="gasAmount" |
| | | <el-table-column prop="gasCost" |
| | | label="æ°è´¹(å
)" |
| | | align="right"> |
| | | <template #default="scope"> |
| | | <span class="amount-value">{{ scope.row.gasAmount }}</span> |
| | | <span class="amount-value">{{ scope.row.gasCost }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="totalConsumption" |
| | |
| | | align="right" |
| | | fixed="right"> |
| | | <template #default="scope"> |
| | | <span class="total-amount-value">Â¥{{ scope.row.totalAmount }}</span> |
| | | <span class="total-amount-value">Â¥{{ scope.row.totalCost }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | }, |
| | | xAxis: { |
| | | type: "category", |
| | | data: data.map(item => item.timePeriod), |
| | | data: data.map(item => item.meterReadingDate), |
| | | axisLabel: { rotate: statisticsType.value === "day" ? 45 : 0 }, |
| | | }, |
| | | yAxis: { |
| | |
| | | }, |
| | | xAxis: { |
| | | type: "category", |
| | | data: data.map(item => item.timePeriod), |
| | | data: data.map(item => item.meterReadingDate), |
| | | axisLabel: { rotate: statisticsType.value === "day" ? 45 : 0 }, |
| | | }, |
| | | yAxis: { |
| | |
| | | { |
| | | name: "æ°´è´¹", |
| | | type: "line", |
| | | data: data.map(item => item.waterAmount), |
| | | data: data.map(item => item.waterCost), |
| | | smooth: true, |
| | | itemStyle: { color: "#409EFF" }, |
| | | }, |
| | | { |
| | | name: "çµè´¹", |
| | | type: "line", |
| | | data: data.map(item => item.electricityAmount), |
| | | data: data.map(item => item.electricityCost), |
| | | smooth: true, |
| | | itemStyle: { color: "#E6A23C" }, |
| | | }, |
| | | { |
| | | name: "æ°è´¹", |
| | | type: "line", |
| | | data: data.map(item => item.gasAmount), |
| | | data: data.map(item => item.gasCost), |
| | | smooth: true, |
| | | itemStyle: { color: "#67C23A" }, |
| | | }, |
| | |
| | | const updateAmountTypeChart = () => { |
| | | const data = tableData.value; |
| | | const totalWaterAmount = data.reduce( |
| | | (sum, item) => sum + parseFloat(item.waterAmount), |
| | | (sum, item) => sum + parseFloat(item.waterCost), |
| | | 0 |
| | | ); |
| | | const totalElectricityAmount = data.reduce( |
| | | (sum, item) => sum + parseFloat(item.electricityAmount), |
| | | (sum, item) => sum + parseFloat(item.electricityCost), |
| | | 0 |
| | | ); |
| | | const totalGasAmount = data.reduce( |
| | | (sum, item) => sum + parseFloat(item.gasAmount), |
| | | (sum, item) => sum + parseFloat(item.gasCost), |
| | | 0 |
| | | ); |
| | | |
| | |
| | | prop="productMaterialSkuId"> |
| | | <el-select v-model="form.productMaterialSkuId" |
| | | @change="handleChangeSpecification" |
| | | filterable |
| | | placeholder="è¯·éæ©"> |
| | | <el-option v-for="item in specificationOptions" |
| | | :key="item.skuId" |
| | |
| | | </el-form-item> |
| | | <el-form-item label="强度" |
| | | prop="strength"> |
| | | <el-input v-model="form.strength" |
| | | placeholder="请è¾å
¥å¼ºåº¦" /> |
| | | <el-select v-model="form.strength" |
| | | placeholder="è¯·éæ©å¼ºåº¦" |
| | | style="width: 100%"> |
| | | <el-option label="A3.5" |
| | | value="A3.5" /> |
| | | <el-option label="A5.0" |
| | | value="A5.0" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="夿³¨ 1" |
| | | prop="remarkOne"> |
| | |
| | | productionPlanCombine, |
| | | } from "@/api/productionPlan/productionPlan.js"; |
| | | import PIMTable from "./components/PIMTable.vue"; |
| | | import { modelListPage, productTreeList } from "@/api/basicData/newProduct.js"; |
| | | import { |
| | | modelListPage, |
| | | productTreeList, |
| | | productTreeListQuery, |
| | | } from "@/api/basicData/newProduct.js"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "æ°æ®æ¥æº", |
| | | width: "100px", |
| | | prop: "dataSourceType", |
| | | dataType: "tag", |
| | | formatType: params => { |
| | | const typeMap = { |
| | | 2: "warning", |
| | | 1: "primary", |
| | | }; |
| | | return typeMap[params] || "info"; |
| | | }, |
| | | formatData: cell => (cell == 1 ? "éé忥" : "æå¨æ°å¢"), |
| | | }, |
| | | { |
| | | label: "ç³è¯·åç¼å·", |
| | | prop: "applyNo", |
| | | width: "150px", |
| | | className: "code-cell", |
| | | }, |
| | | { |
| | | label: "客æ·åç§°", |
| | |
| | | { |
| | | label: "产ååç§°", |
| | | prop: "productName", |
| | | width: "100px", |
| | | width: "200px", |
| | | dataType: "tag", |
| | | formatType: params => { |
| | | const typeMap = { |
| | | æ¿æ: "primary", |
| | | ç å: "info", |
| | | }; |
| | | return typeMap[params] || "info"; |
| | | // const typeMap = { |
| | | // æ¿æ: "primary", |
| | | // ç å: "warning", |
| | | // }; |
| | | // return typeMap[params] || "info"; |
| | | return "primary"; |
| | | }, |
| | | }, |
| | | { |
| | |
| | | label: "ç©æç¼ç ", |
| | | prop: "materialCode", |
| | | width: "150px", |
| | | className: "code-cell", |
| | | }, |
| | | { |
| | | label: "åæ°", |
| | | prop: "quantity", |
| | | className: "quantity-cell", |
| | | formatData: cell => (cell ? `${cell}å` : ""), |
| | | }, |
| | | { |
| | | label: "æ¹æ°", |
| | | prop: "volume", |
| | | width: "150px", |
| | | className: "volume-cell", |
| | | formatData: cell => (cell ? `${cell}æ¹` : ""), |
| | | }, |
| | | { |
| | | label: "ä¸åç¶æ", |
| | | prop: "status", |
| | | width: "150px", |
| | | className: "status-cell", |
| | | dataType: "tag", |
| | | formatType: params => { |
| | | const typeMap = { |
| | | 0: "warning", |
| | | 1: "primary", |
| | | 2: "info", |
| | | }; |
| | | return typeMap[params] || "info"; |
| | | }, |
| | | formatData: cell => { |
| | | const statusMap = { |
| | | 0: "å¾
ä¸å", |
| | | 1: "é¨åä¸å", |
| | | 2: "å·²ä¸å", |
| | | }; |
| | | return statusMap[cell] || ""; |
| | | }, |
| | | }, |
| | | { |
| | | label: "å·²ä¸åæ¹æ°", |
| | | prop: "assignedQuantity", |
| | | width: "150px", |
| | | className: "spec-cell", |
| | | formatData: cell => (cell ? `${cell}æ¹` : 0), |
| | | }, |
| | | { |
| | | label: "é¿", |
| | | prop: "length", |
| | | className: "dimension-cell", |
| | | formatData: cell => (cell ? `${cell}mm` : ""), |
| | | }, |
| | | { |
| | | label: "宽", |
| | | prop: "width", |
| | | className: "dimension-cell", |
| | | formatData: cell => (cell ? `${cell}mm` : ""), |
| | | }, |
| | | { |
| | | label: "é«", |
| | | prop: "height", |
| | | className: "dimension-cell", |
| | | formatData: cell => (cell ? `${cell}mm` : ""), |
| | | }, |
| | | { |
| | | label: "æµæ°´å·", |
| | | prop: "serialNo", |
| | | width: "150px", |
| | | className: "code-cell", |
| | | }, |
| | | // { |
| | | // label: "æµæ°´å·", |
| | | // prop: "serialNo", |
| | | // width: "150px", |
| | | // className: "code-cell", |
| | | // }, |
| | | { |
| | | label: "计åå¼å§æ¥æ", |
| | | prop: "startDate", |
| | |
| | | label: "强度", |
| | | prop: "strength", |
| | | }, |
| | | // { |
| | | // label: "æ°æ®æ¥æº", |
| | | // width: "100px", |
| | | // prop: "dataSourceType", |
| | | // formatData: cell => (cell == 1 ? "忥" : "æå¨"), |
| | | // }, |
| | | |
| | | { |
| | | label: "夿³¨ 1", |
| | | width: "150px", |
| | | prop: "remarkOne", |
| | | }, |
| | | { |
| | | label: "夿³¨ 2", |
| | | width: "150px", |
| | | prop: "remarkTwo", |
| | | }, |
| | | |
| | |
| | | name: "ç¼è¾", |
| | | type: "primary", |
| | | link: true, |
| | | showHide: row => { |
| | | return row.status == 0; |
| | | //statusï¼0ï¼å¾
ä¸åï¼1ï¼é¨åä¸åï¼2ï¼å·²ä¸å |
| | | }, |
| | | clickFun: row => { |
| | | handleEdit(row); |
| | | }, |
| | |
| | | name: "å é¤", |
| | | type: "danger", |
| | | link: true, |
| | | showHide: row => { |
| | | return row.status == 0; |
| | | }, |
| | | clickFun: row => { |
| | | handleDelete(row); |
| | | }, |
| | |
| | | { |
| | | name: "ä¸å", |
| | | type: "text", |
| | | disabled: row => { |
| | | showHide: row => { |
| | | // 计ç®å©ä½æ¹æ° |
| | | const remainingVolume = |
| | | (row.volume || 0) - (row.assignedQuantity || 0); |
| | | // 妿å©ä½æ¹æ°å°äºçäº0ï¼ç¦æ¢éæ© |
| | | return remainingVolume <= 0; |
| | | return remainingVolume > 0; |
| | | }, |
| | | clickFun: row => { |
| | | // åç¬ä¸åæä½ |
| | |
| | | productMaterialSkuId: [ |
| | | { required: true, message: "è¯·éæ©äº§åè§æ ¼", trigger: "change" }, |
| | | ], |
| | | volume: [{ required: true, message: "请è¾å
¥æ¹æ°", trigger: "blur" }], |
| | | productMaterialId: [ |
| | | { required: true, message: "è¯·éæ©äº§å", trigger: "change" }, |
| | | ], |
| | |
| | | }; |
| | | |
| | | const fetchProductOptions = () => { |
| | | return productTreeList().then(res => { |
| | | return productTreeList({ type: 2 }).then(res => { |
| | | productOptions.value = convertIdToValue(res.data); |
| | | return res; |
| | | }); |
| | |
| | | const fetchSpecificationOptions = materialId => { |
| | | specificationOptions.value = []; |
| | | if (materialId) { |
| | | modelListPage({ materialId: materialId }).then(res => { |
| | | specificationOptions.value = res.data; |
| | | }); |
| | | modelListPage({ materialId: materialId, size: -1, current: -1 }).then( |
| | | res => { |
| | | specificationOptions.value = res.data.records; |
| | | } |
| | | ); |
| | | } |
| | | }; |
| | | |
| | | const handleChangeSpecification = value => { |
| | | form.materialCode = undefined; |
| | | const selectedModel = specificationOptions.value.find( |
| | | item => item.id === value |
| | | item => item.skuId === value |
| | | ); |
| | | if (selectedModel) { |
| | | form.materialCode = selectedModel.materialCode; |
| | | // è§£æè§æ ¼å符串è·åé¿å®½é« |
| | | const specification = selectedModel.specification; |
| | | if (specification) { |
| | | const dimensions = specification.match(/^(\d+)\*(\d+)\*(\d+)$/); |
| | | if (dimensions && dimensions.length === 4) { |
| | | form.length = parseInt(dimensions[1]); |
| | | form.width = parseInt(dimensions[2]); |
| | | form.height = parseInt(dimensions[3]); |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | |
| | |
| | | const handleSubmit = () => { |
| | | formRef.value.validate(valid => { |
| | | if (valid) { |
| | | if (form.volume === 0) { |
| | | proxy.$modal.msgError("æ¹æ°ä¸è½ä¸º0"); |
| | | return; |
| | | } |
| | | if (form.v === "add") { |
| | | payload.id = null; |
| | | } |
| | | const payload = { ...form }; |
| | | if (operationType.value === "add") { |
| | | payload.id = null; |
| | | productionPlanAdd(payload) |
| | | .then(() => { |
| | | proxy.$modal.msgSuccess( |
| | |
| | | color: #ffffff; |
| | | border-bottom: none; |
| | | padding: 16px 0; |
| | | font-size: 14px; |
| | | letter-spacing: 0.5px; |
| | | } |
| | | } |
| | |
| | | border-bottom: 1px solid #f0f0f0; |
| | | padding: 14px 0; |
| | | color: #303133; |
| | | font-size: 13px; |
| | | } |
| | | } |
| | | |
| | |
| | | font-weight: 600; |
| | | color: #409eff; |
| | | font-family: "Courier New", monospace; |
| | | font-size: 14px; |
| | | text-shadow: 0 1px 2px rgba(64, 158, 255, 0.2); |
| | | } |
| | | |
| | |
| | | // æ¥æåæ®µæ ·å¼ |
| | | .date-cell { |
| | | color: #909399; |
| | | font-size: 12px; |
| | | font-style: italic; |
| | | } |
| | | |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title ml10">ç©æç¼ç ï¼</span> |
| | | <el-input v-model="searchForm.materialCode" |
| | | style="width: 200px" |
| | | placeholder="请è¾å
¥ç©æç¼ç " |
| | | clearable /> |
| | | <span class="search_title ml10">产ååç§°ï¼</span> |
| | | <el-input v-model="searchForm.productName" |
| | | style="width: 200px" |
| | | placeholder="请è¾å
¥äº§ååç§°" |
| | | clearable /> |
| | | <el-button type="primary" |
| | | @click="handleQuery" |
| | | style="margin-left: 10px">æç´¢</el-button> |
| | | <el-button @click="handleReset">éç½®</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <PIMTable rowKey="materialCode" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | height="calc(100vh - 200px)" |
| | | height="calc(100vh - 280px)" |
| | | :tableLoading="tableLoading" |
| | | :isSelection="false" |
| | | :isShowSummary="true" |
| | | :summaryMethod="summaryMethod" |
| | | @pagination="pagination"> |
| | | </PIMTable> |
| | | </div> |
| | |
| | | { |
| | | label: "ç©æç¼ç ", |
| | | prop: "materialCode", |
| | | className: "code-cell", |
| | | }, |
| | | { |
| | | label: "产ååç§°", |
| | | prop: "productName", |
| | | dataType: "tag", |
| | | formatType: params => { |
| | | const typeMap = { |
| | | æ¿æ: "primary", |
| | | ç å: "info", |
| | | }; |
| | | return typeMap[params] || "info"; |
| | | return "primary"; |
| | | }, |
| | | }, |
| | | { |
| | | label: "产åè§æ ¼", |
| | | prop: "productSpec", |
| | | prop: "specification", |
| | | className: "spec-cell", |
| | | }, |
| | | { |
| | | label: "é¿", |
| | | prop: "length", |
| | | className: "dimension-cell", |
| | | formatData: cell => (cell ? `${cell}mm` : ""), |
| | | }, |
| | | { |
| | | label: "宽", |
| | | prop: "width", |
| | | className: "dimension-cell", |
| | | formatData: cell => (cell ? `${cell}mm` : ""), |
| | | }, |
| | | { |
| | | label: "é«", |
| | | prop: "height", |
| | | className: "dimension-cell", |
| | | formatData: cell => (cell ? `${cell}mm` : ""), |
| | | }, |
| | | { |
| | | label: "åæ°", |
| | | prop: "quantity", |
| | | className: "quantity-cell", |
| | | formatData: cell => (cell ? `${cell}å` : ""), |
| | | }, |
| | | { |
| | | label: "æ¹æ°", |
| | | prop: "volume", |
| | | className: "volume-cell", |
| | | formatData: cell => (cell ? `${cell}æ¹` : ""), |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | |
| | | |
| | | // æç´¢è¡¨å |
| | | const searchForm = reactive({ |
| | | materialCode: "", |
| | | productName: "", |
| | | productSpec: "", |
| | | }); |
| | | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | |
| | | /** éç½®æé®æä½ */ |
| | | const handleReset = () => { |
| | | searchForm.materialCode = ""; |
| | | searchForm.productName = ""; |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | |
| | | .catch(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | // æ±æ»æ¹æ³ |
| | | const summaryMethod = ({ columns, data }) => { |
| | | const sums = []; |
| | | columns.forEach((column, index) => { |
| | | if (index === 0) { |
| | | sums[index] = "æ»è®¡"; |
| | | return; |
| | | } |
| | | if (column.property === "quantity") { |
| | | const total = data.reduce((acc, item) => { |
| | | return acc + (Number(item.quantity) || 0); |
| | | }, 0); |
| | | sums[index] = `${total}å`; |
| | | } else if (column.property === "volume") { |
| | | const total = data.reduce((acc, item) => { |
| | | return acc + (Number(item.volume) || 0); |
| | | }, 0); |
| | | sums[index] = `${total.toFixed(4)}æ¹`; |
| | | } else { |
| | | sums[index] = ""; |
| | | } |
| | | }); |
| | | return sums; |
| | | }; |
| | | |
| | | onMounted(() => { |
| | |
| | | &:hover { |
| | | box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.08); |
| | | } |
| | | |
| | | .search_title { |
| | | color: #606266; |
| | | font-size: 14px; |
| | | font-weight: 500; |
| | | } |
| | | |
| | | .ml10 { |
| | | margin-left: 10px; |
| | | } |
| | | } |
| | | |
| | | .table_list { |
| | |
| | | border-radius: 6px; |
| | | box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05); |
| | | overflow: hidden; |
| | | height: calc(100vh - 150px); |
| | | height: calc(100vh - 230px); |
| | | } |
| | | |
| | | :deep(.el-table) { |
| | |
| | | color: #ffffff; |
| | | border-bottom: none; |
| | | padding: 16px 0; |
| | | font-size: 14px; |
| | | letter-spacing: 0.5px; |
| | | } |
| | | } |
| | |
| | | border-bottom: 1px solid #f0f0f0; |
| | | padding: 14px 0; |
| | | color: #303133; |
| | | font-size: 13px; |
| | | } |
| | | } |
| | | |
| | |
| | | font-weight: 600; |
| | | color: #409eff; |
| | | font-family: "Courier New", monospace; |
| | | font-size: 14px; |
| | | text-shadow: 0 1px 2px rgba(64, 158, 255, 0.2); |
| | | } |
| | | |
| | |
| | | // æ¥æåæ®µæ ·å¼ |
| | | .date-cell { |
| | | color: #909399; |
| | | font-size: 12px; |
| | | font-style: italic; |
| | | } |
| | | } |
| | |
| | | const { VITE_APP_ENV } = env; |
| | | const baseUrl = |
| | | env.VITE_APP_ENV === "development" |
| | | ? "http://192.168.1.248:9090" |
| | | ? "http://192.168.1.234:9019" |
| | | : env.VITE_BASE_API; |
| | | const javaUrl = |
| | | env.VITE_APP_ENV === "development" |