| | |
| | | </div> |
| | | <div class="right"> |
| | | <el-row :gutter="24"> |
| | | <el-col :span="2" :offset="20"><el-button :icon="Delete" type="danger">å é¤</el-button></el-col> |
| | | <el-col :span="2"><el-button :icon="Plus" type="primary">æ°å¢</el-button></el-col> |
| | | <el-col :span="2" :offset="20" |
| | | ><el-button :icon="Delete" type="danger" @click="delHandler">å é¤</el-button></el-col |
| | | > |
| | | <el-col :span="2" |
| | | ><el-button |
| | | :icon="Plus" |
| | | type="primary" |
| | | @click="add" |
| | | :disabled="!tableData.length" |
| | | >æ°å¢</el-button |
| | | ></el-col |
| | | > |
| | | </el-row> |
| | | <ETable |
| | | :maxHeight="1200" |
| | | :loading="loading" |
| | | :table-data="tableData" |
| | | :columns="columns" |
| | |
| | | </ETable> |
| | | <Pagination |
| | | :total="total" |
| | | :page-size="10" |
| | | :page-count="Math.ceil(total / 10)" |
| | | @page-change="currentPageChange" |
| | | :page="queryParams.current" |
| | | :limit="queryParams.pageSize" |
| | | :show-total="true" |
| | | @pagination="handlePageChange" |
| | | :layout="'total, prev, pager, next, jumper'" |
| | | ></Pagination> |
| | | </div> |
| | | <archiveDialog |
| | | v-model:centerDialogVisible="dialogVisible" |
| | | @centerDialogVisible="centerDialogVisible" |
| | | :row="row" |
| | | @submitForm="submitForm" |
| | | > |
| | | </archiveDialog> |
| | | </el-card> |
| | | </template> |
| | | <script setup> |
| | | import { onMounted, ref, nextTick } from "vue"; |
| | | import { onMounted, ref, nextTick, reactive } from "vue"; |
| | | import ETable from "@/components/Table/ETable.vue"; |
| | | import { ElButton, ElInput, ElIcon } from "element-plus"; |
| | | import { ElButton, ElInput, ElIcon, ElMessage } from "element-plus"; |
| | | import archiveDialog from "./mould/archiveDialog.vue"; |
| | | import Pagination from "@/components/Pagination/index.vue"; |
| | | import { |
| | | Plus, |
| | |
| | | addOrEditArchive, |
| | | delArchive, |
| | | } from "@/api/archiveManagement"; |
| | | const dialogVisible = ref(false); // æ§å¶å½æ¡£å¯¹è¯æ¡æ¾ç¤º |
| | | const loading = ref(false); |
| | | const tableData = ref([]); |
| | | const treeData = ref([]); |
| | |
| | | const filterText = ref(""); // æç´¢å
³é®å |
| | | const treeRef = ref(); // æ ç»ä»¶å¼ç¨ |
| | | const total = ref(0); // æ»è®°å½æ° |
| | | const current = ref(1); // å½å页ç |
| | | const columns = [ |
| | | { prop: "name", label: "åç§°", minWidth: 180 }, |
| | | { prop: "type", label: "ç±»å", minWidth: 120 }, |
| | | { prop: "status", label: "ç¶æ", minWidth: 100 }, |
| | | ]; |
| | | const selectedRows = reactive([]); // åå¨éä¸è¡æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | console.log("Selected rows:", selection); |
| | | selectedRows.splice(0, selectedRows.length, ...selection); |
| | | }; |
| | | |
| | | const queryParams = reactive({ |
| | | searchText: "", |
| | | current: 1, |
| | | pageSize: 10, // åºå®æ¯é¡µ10æ¡ |
| | | treeId: null, // å½åæ èç¹ID |
| | | }); |
| | | // æç´¢è¿æ»¤åè½ |
| | | const handleFilter = () => { |
| | | treeRef.value?.filter(filterText.value); |
| | | }; |
| | | |
| | | const row = ref({}); // å½åéä¸è¡æ°æ® |
| | | const filterNode = (value, data) => { |
| | | if (!value) return true; |
| | | return data.name?.toLowerCase().includes(value.toLowerCase()); |
| | | }; |
| | | const submitForm = async (res) => { |
| | | console.log("æäº¤è¡¨ååè°:", res); |
| | | |
| | | if (res && res.code === 200) { |
| | | ElMessage.success("æä½æå"); |
| | | // å·æ°åè¡¨æ°æ® |
| | | await getArchiveListData(); |
| | | } else { |
| | | ElMessage.error("æä½å¤±è´¥: " + (res?.message || "æªç¥é误")); |
| | | } |
| | | } |
| | | const centerDialogVisible = (val) => { |
| | | console.log(val); |
| | | }; |
| | | // å¤çèç¹ç¹å» |
| | | const handleNodeClick = async (data) => { |
| | | console.log("ç¹å»èç¹:", data); |
| | | let res = await getArchiveList(data.id); |
| | | tableData.value = res.data?.records || res.data || []; |
| | | console.log(data) |
| | | // 忢èç¹æ¶éç½®å°ç¬¬ä¸é¡µ |
| | | queryParams.current = 1; |
| | | queryParams.treeId = data.id; |
| | | getArchiveListData(); |
| | | }; |
| | | const currentPageChange = (id) => { |
| | | console.log(id); |
| | | // add |
| | | const add = () => { |
| | | row.value = {}; // æ¸
ç©ºè¡æ°æ®ï¼ç¡®ä¿æ¯æ°å¢æ¨¡å¼ |
| | | dialogVisible.value = true; |
| | | newName.value = ""; // æ¸
空è¾å
¥æ¡ |
| | | }; |
| | | // å¤çå页åå |
| | | const handlePageChange = ({ page }) => { |
| | | console.log("å页åå:", { page }); |
| | | queryParams.current = page; |
| | | // pageSize åºå®ä¸º20ï¼ä¸åä»åæ°ä¸è·å |
| | | getArchiveListData(); |
| | | }; |
| | | |
| | | const getArchiveListData = async () => { |
| | | try { |
| | | loading.value = true; |
| | | console.log("è·å彿¡£åè¡¨æ°æ®", { |
| | | treeId: queryParams.treeId, |
| | | current: queryParams.current, |
| | | pageSize: queryParams.pageSize, |
| | | }); |
| | | |
| | | let res = await getArchiveList({ |
| | | treeId: queryParams.treeId, |
| | | current: queryParams.current, |
| | | size: queryParams.pageSize, |
| | | }); |
| | | |
| | | if (res.code !== 200) { |
| | | ElMessage.error("è·åæ°æ®å¤±è´¥: " + res.message); |
| | | tableData.value = []; |
| | | total.value = 0; |
| | | return; |
| | | } |
| | | |
| | | tableData.value = res.data?.records || res.data || []; |
| | | total.value = res.data?.total || 0; |
| | | // ç¡®ä¿å页忰æ£ç¡®æ´æ° |
| | | if (res.data?.current) { |
| | | queryParams.current = res.data.current; |
| | | } |
| | | // pageSize åºå®ä¸º20ï¼ä¸ä»å端è·å |
| | | |
| | | console.log("æ°æ®æ´æ°å®æ:", { |
| | | total: total.value, |
| | | current: queryParams.current, |
| | | pageSize: queryParams.pageSize, |
| | | records: tableData.value.length, |
| | | }); |
| | | } catch (error) { |
| | | console.error("è·å彿¡£å表失败:", error); |
| | | ElMessage.error("è·åæ°æ®å¤±è´¥"); |
| | | tableData.value = []; |
| | | total.value = 0; |
| | | } finally { |
| | | loading.value = false; |
| | | } |
| | | }; |
| | | const delHandler = async () => { |
| | | if (selectedRows.length === 0) { |
| | | ElMessage.warning("è¯·éæ©è¦å é¤çæ°æ®"); |
| | | return; |
| | | } |
| | | try { |
| | | const ids = selectedRows.map((row) => row.id); |
| | | console.log(ids) |
| | | const { code, msg } = await delArchive(ids); |
| | | if (code !== 200) { |
| | | ElMessage.warning("å é¤å¤±è´¥: " + msg); |
| | | } else { |
| | | ElMessage.success("å 餿å"); |
| | | // å 餿ååéæ°è·åæ°æ® |
| | | await getArchiveListData(); |
| | | } |
| | | } catch (error) { |
| | | console.error("å é¤å½æ¡£å¤±è´¥:", error); |
| | | ElMessage.error("å é¤å½æ¡£å¤±è´¥"); |
| | | } |
| | | }; |
| | | // åå»ç¼è¾èç¹ |
| | | const headerDbClick = (comeTreeData) => { |
| | |
| | | } |
| | | }; |
| | | |
| | | const handleEdit = () => {}; |
| | | const handleEdit = (rows) => { |
| | | row.value = rows; |
| | | dialogVisible.value = true; |
| | | console.log("ç¼è¾èç¹:", row.value); |
| | | }; |
| | | |
| | | // ç§»é¤æå è½½ï¼ç´æ¥è·åæ°æ® |
| | | const getList = async () => { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <el-dialog v-model="centerDialogVisible" title="Warning" width="500" center> |
| | | <el-form |
| | | ref="ruleFormRef" |
| | | style="max-width: 600px" |
| | | :model="ruleForm" |
| | | :rules="rules" |
| | | label-width="auto" |
| | | > |
| | | <el-form-item label="åç§°" prop="name"> |
| | | <el-input v-model="ruleForm.name" placeholder="请è¾å
¥ææ¡£åç§°"/> |
| | | </el-form-item> |
| | | <el-form-item label="请è¾å
¥ææ¡£ç±»å" prop="type"> |
| | | <el-select v-model="ruleForm.type" placeholder="请è¾å
¥ææ¡£ç±»å"> |
| | | <el-option label="åå" value="åå" /> |
| | | <el-option label="æ¥å" value="æ¥å" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="请è¾å
¥ææ¡£ç¶æ" prop="status"> |
| | | <el-select v-model="ruleForm.status" placeholder="请è¾å
¥ææ¡£ç¶æ"> |
| | | <el-option v-for="option in options" :key="option.value" :label="option.label" :value="option.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button @click="centerDialogVisible = false">Cancel</el-button> |
| | | <el-button type="primary" @click="submit"> |
| | | Confirm |
| | | </el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, watch } from "vue"; |
| | | import { addOrEditArchive } from "@/api/archiveManagement" |
| | | |
| | | const centerDialogVisible = defineModel("centerDialogVisible", { |
| | | type: Boolean, |
| | | default: false, |
| | | }); |
| | | |
| | | const props = defineProps({ |
| | | row: { |
| | | type: Object, |
| | | default: () => ({}), |
| | | }, |
| | | }); |
| | | const copyFormData = (data) => { |
| | | return JSON.parse(JSON.stringify(data)); |
| | | }; |
| | | // åå§åè¡¨åæ°æ®çè¾
å©å½æ° |
| | | const initFormData = (rowData) => { |
| | | if (rowData && rowData.id) { |
| | | return copyFormData(rowData); |
| | | } |
| | | return { |
| | | name: "", |
| | | type: "", |
| | | status: "", |
| | | }; |
| | | }; |
| | | |
| | | // åå§åè¡¨åæ°æ® |
| | | const ruleFormRef = ref(null); |
| | | const ruleForm = ref(initFormData(props.row)); |
| | | const copyForm = ref() |
| | | // çå¬ row çååï¼æ´æ° ruleForm |
| | | watch(() => props.row, (newRow) => { |
| | | copyForm.value = initFormData(newRow); |
| | | ruleForm.value = JSON.parse(JSON.stringify(copyForm.value)); |
| | | }, { deep: true }); |
| | | const rules = { |
| | | name: [ |
| | | { required: true, message: "Please input activity name", trigger: "blur" }, |
| | | ], |
| | | type: [ |
| | | { required: true, message: "Please select activity zone", trigger: "change" }, |
| | | ], |
| | | status: [ |
| | | { required: true, message: "Please select activity count", trigger: "change" }, |
| | | ], |
| | | }; |
| | | |
| | | const options = [ |
| | | { value: "ææ", label: "ææ" }, |
| | | { value: "æ æ", label: "æ æ" }, |
| | | { value: "ä½åº", label: "ä½åº" }, |
| | | ]; |
| | | const emit = defineEmits(["submitForm"]); |
| | | const submit = async () => { |
| | | // éªè¯è¡¨å |
| | | if (!ruleFormRef.value) return; |
| | | |
| | | try { |
| | | const valid = await ruleFormRef.value.validate(); |
| | | if (!valid) { |
| | | return; |
| | | } |
| | | |
| | | // è°ç¨ API |
| | | let res = await addOrEditArchive(ruleForm.value); |
| | | console.log("API ååº:", res); |
| | | |
| | | // åé emit äºä»¶ |
| | | emit("submitForm", res); |
| | | console.log("emit submitForm å·²åé"); |
| | | |
| | | // å
³éå¯¹è¯æ¡ |
| | | centerDialogVisible.value = false; |
| | | } catch (error) { |
| | | console.error("表åéªè¯å¤±è´¥æAPIè°ç¨å¤±è´¥:", error); |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped></style> |
| | |
| | | } |
| | | }, |
| | | { prop: "contactAddress", label: "è系人详ç»å°å", minWidth: 120 }, |
| | | { prop: "createTime", label: "ç»´æ¤æ¥æ", minWidth: 120 }, |
| | | { prop: "updateTime", label: "ç»´æ¤æ¥æ", minWidth: 120 }, |
| | | ]); |
| | | |
| | | /** |
| | |
| | | if (!formRef.value) return |
| | | await formRef.value.validate(async (valid, fields) => { |
| | | if (valid) { |
| | | delete formData.value.createTime |
| | | delete formData.value.updateTime |
| | | delete formData.value.maintainerName // å 餿¾ç¤ºç¨çåæ®µï¼åªä¿çID |
| | | |
| | | // ç¡®ä¿maintainerIdæå¼ |
| | |
| | | result |
| | | }; |
| | | } else { |
| | | delete formData.value.createTime |
| | | delete formData.value.updateTime |
| | | let result = await addOrEditCoalField({ |
| | | ...formData.value, |
| | | }) |
| | |
| | | coalFields: stringifyCoalFields(formData.value.coalFields), |
| | | fieldIds: stringifyCoalFields(formData.value.fieldIds) |
| | | }; |
| | | |
| | | // å é¤ä¸éè¦çæ¶é´å段ï¼ç¼è¾æ¶ï¼ |
| | | if (isEditMode.value) { |
| | | delete submitData.createTime; |
| | | delete submitData.updateTime; |
| | | } |
| | | |
| | | // è°ç¨APIæäº¤æ°æ® |
| | | const result = await addOrEditCoalPlan(submitData); |
| | | |
| | |
| | | result |
| | | }; |
| | | } else { |
| | | delete formData.value.createTime |
| | | delete formData.value.updateTime |
| | | let result = await addOrEditCustomer({ |
| | | ...formData.value, |
| | | }) |
| | |
| | | result |
| | | }; |
| | | } else { |
| | | delete formData.value.createTime |
| | | delete formData.value.updateTime |
| | | let result = await addOrEditSupply({ |
| | | ...formData.value, |
| | | }) |
| | |
| | | style="max-width: 400px; margin: 0 auto" |
| | | > |
| | | <el-form-item label="ä¾åºååç§°" prop="supplierName"> |
| | | <el-input v-model="form.supplierName" placeholder="请è¾å
¥" /> |
| | | <el-select v-model="form.supplierName" placeholder="è¯·éæ©ä¾åºå"> |
| | | <el-option :label="item.label" v-for="item in supplyList" :key="item.value" :value="item.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ç
¤ç§" prop="coal"> |
| | | <el-select v-model="form.coal" placeholder="è¯·éæ©ç
¤ç§" clearable style="width: 100%"> |
| | | <el-option label="ç¦ç
¤" value="ç¦ç
¤" /> |
| | | <el-option label="æ°ç
¤" value="æ°ç
¤" /> |
| | | <el-option label="æ çç
¤" value="æ çç
¤" /> |
| | | <el-option label="é¿ç°ç
¤" value="é¿ç°ç
¤" /> |
| | | <el-option label="è´«ç
¤" value="è´«ç
¤" /> |
| | | <el-select v-model="form.coal" placeholder="è¯·éæ©ç
¤ç§"> |
| | | <el-option :label="item.label" v-for="item in coalList" :key="item.value" :value="item.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="åä½" prop="unit"> |
| | | <el-select v-model="form.unit" placeholder="è¯·éæ©åä½" clearable style="width: 100%"> |
| | | <el-select |
| | | v-model="form.unit" |
| | | placeholder="è¯·éæ©åä½" |
| | | clearable |
| | | style="width: 100%" |
| | | > |
| | | <el-option label="å¨" value="å¨" /> |
| | | <el-option label="åå
" value="åå
" /> |
| | | </el-select> |
| | | </el-form-item> <el-form-item label="éè´æ°é" prop="purchaseQuantity"> |
| | | </el-form-item> |
| | | <el-form-item label="éè´æ°é" prop="purchaseQuantity"> |
| | | <el-input |
| | | v-model.number="form.purchaseQuantity" |
| | | placeholder="请è¾å
¥" |
| | | @blur="handleQuantityBlur" |
| | | > |
| | | <template v-slot:suffix> |
| | | <i style="font-style:normal;">{{form.unit?form.unit:''}}</i> |
| | | <i style="font-style: normal">{{ form.unit ? form.unit : "" }}</i> |
| | | </template> |
| | | </el-input> |
| | | </el-form-item><el-form-item label="ç¨ç" prop="taxRate"> |
| | | </el-input> </el-form-item |
| | | ><el-form-item label="ç¨ç" prop="taxRate"> |
| | | <el-input |
| | | v-model.number="form.taxRate" |
| | | placeholder="请è¾å
¥ç¨ç" |
| | | @blur="handleTaxRateBlur" |
| | | > |
| | | <template v-slot:suffix> |
| | | <i style="font-style:normal;">%</i> |
| | | <i style="font-style: normal">%</i> |
| | | </template> |
| | | </el-input> |
| | | </el-form-item> |
| | |
| | | @blur="handlePriceBlur" |
| | | > |
| | | <template v-slot:suffix> |
| | | <i style="font-style:normal;">å
</i> |
| | | <i style="font-style: normal">å
</i> |
| | | </template> |
| | | </el-input> |
| | | </el-form-item> <el-form-item label="åä»·(å«ç¨)" prop="priceIncludingTax"> |
| | | </el-form-item> |
| | | <el-form-item label="åä»·(å«ç¨)" prop="priceIncludingTax"> |
| | | <el-input |
| | | v-model.number="form.priceIncludingTax" |
| | | placeholder="èªå¨è®¡ç®" |
| | | > |
| | | <template v-slot:suffix> |
| | | <i style="font-style:normal;">å
</i> |
| | | <i style="font-style: normal">å
</i> |
| | | </template> |
| | | </el-input> |
| | | </el-form-item> |
| | |
| | | placeholder="èªå¨è®¡ç®" |
| | | > |
| | | <template v-slot:suffix> |
| | | <i style="font-style:normal;">å
</i> |
| | | <i style="font-style: normal">å
</i> |
| | | </template> |
| | | </el-input> |
| | | </el-form-item> |
| | |
| | | placeholder="èªå¨è®¡ç®" |
| | | > |
| | | <template v-slot:suffix> |
| | | <i style="font-style:normal;">å
</i> |
| | | <i style="font-style: normal">å
</i> |
| | | </template> |
| | | </el-input> |
| | | </el-form-item> |
| | |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <!-- éç½®ååæ¶ --> |
| | | <el-button |
| | | @click="handleClose" |
| | | v-if="title.includes('æ°å¢')" |
| | | <el-button @click="handleClose" v-if="title.includes('æ°å¢')" |
| | | >åæ¶</el-button |
| | | > |
| | | <el-button |
| | | @click="handleReset" |
| | | v-if="title.includes('ç¼è¾')" |
| | | <el-button @click="handleReset" v-if="title.includes('ç¼è¾')" |
| | | >éç½®</el-button |
| | | > |
| | | <el-button type="primary" @click="handleSubmit">确认</el-button> |
| | |
| | | <script setup name="ProductionDialog"> |
| | | import { ref, defineProps, watch, onMounted, nextTick, computed } from "vue"; |
| | | import { ElMessage } from "element-plus"; |
| | | import useUserStore from '@/store/modules/user' |
| | | import useUserStore from "@/store/modules/user"; |
| | | import {addOrEditPR} from "@/api/procureMent"; |
| | | import { getSupply } from "@/api/basicInformation/supplier"; |
| | | import { getCoalInfo } from "@/api/basicInformation/coal"; |
| | | const props = defineProps({ |
| | | title: { |
| | | type: String, |
| | |
| | | required: true, |
| | | type: Object, |
| | | }); |
| | | const supplyList = ref([]); |
| | | const coalList = ref([]); |
| | | // è·åä¾åºå䏿åç
¤ç§ä¸æ |
| | | const getDropdownData = async () => { |
| | | try { |
| | | const [supplyRes, coalRes] = await Promise.all([ |
| | | getSupply(), |
| | | getCoalInfo(), |
| | | ]); |
| | | let supplyData = supplyRes.data.records; |
| | | let coalData = coalRes.data.records; |
| | | supplyList.value = supplyData.map((item) => ({ |
| | | value: item.id, |
| | | label: item.supplierName, |
| | | })); |
| | | coalList.value = coalData.map((item) => ({ |
| | | value: item.id, |
| | | label: item.coal, |
| | | })); |
| | | console.log(supplyList.value, coalList.value); |
| | | } catch (error) { |
| | | console.error("è·åä¸ææ°æ®å¤±è´¥:", error); |
| | | } |
| | | }; |
| | | |
| | | defineExpose({ |
| | | getDropdownData, |
| | | }); |
| | | const toFixed = (num, precision = 2) => { |
| | | if (isNaN(num) || num === null || num === undefined || num === '') { |
| | | if (isNaN(num) || num === null || num === undefined || num === "") { |
| | | return 0; |
| | | } |
| | | return Math.floor(parseFloat(num) * Math.pow(10, precision)) / Math.pow(10, precision); |
| | | return ( |
| | | Math.floor(parseFloat(num) * Math.pow(10, precision)) / |
| | | Math.pow(10, precision) |
| | | ); |
| | | }; |
| | | // å«ç¨åä»·è®¡ç® |
| | | const unitPriceWithTax = computed(() => { |
| | |
| | | form.value.totalPriceExcludingTax = newValue; |
| | | }); |
| | | |
| | | const userStore = useUserStore() |
| | | const userStore = useUserStore(); |
| | | const userInfo = ref({}); |
| | | |
| | | // å¤çç¨çè¾å
¥æ¡å¤±ç¦ï¼ç¡®ä¿ç²¾åº¦ |
| | | const handleTaxRateBlur = () => { |
| | | if (form.value.taxRate !== null && form.value.taxRate !== undefined && form.value.taxRate !== '') { |
| | | if ( |
| | | form.value.taxRate !== null && |
| | | form.value.taxRate !== undefined && |
| | | form.value.taxRate !== "" |
| | | ) { |
| | | form.value.taxRate = toFixed(parseFloat(form.value.taxRate), 2); |
| | | } |
| | | }; |
| | | |
| | | // å¤çä¸å«ç¨åä»·è¾å
¥æ¡å¤±ç¦ï¼ç¡®ä¿ç²¾åº¦ |
| | | const handlePriceBlur = () => { |
| | | if (form.value.priceExcludingTax !== null && form.value.priceExcludingTax !== undefined && form.value.priceExcludingTax !== '') { |
| | | form.value.priceExcludingTax = toFixed(parseFloat(form.value.priceExcludingTax), 2); |
| | | if ( |
| | | form.value.priceExcludingTax !== null && |
| | | form.value.priceExcludingTax !== undefined && |
| | | form.value.priceExcludingTax !== "" |
| | | ) { |
| | | form.value.priceExcludingTax = toFixed( |
| | | parseFloat(form.value.priceExcludingTax), |
| | | 2 |
| | | ); |
| | | } |
| | | }; |
| | | |
| | | // å¤çéè´æ°éè¾å
¥æ¡å¤±ç¦ï¼ç¡®ä¿ç²¾åº¦ |
| | | const handleQuantityBlur = () => { |
| | | if (form.value.purchaseQuantity !== null && form.value.purchaseQuantity !== undefined && form.value.purchaseQuantity !== '') { |
| | | form.value.purchaseQuantity = toFixed(parseFloat(form.value.purchaseQuantity), 3); // æ°éä¿ç3ä½å°æ° |
| | | if ( |
| | | form.value.purchaseQuantity !== null && |
| | | form.value.purchaseQuantity !== undefined && |
| | | form.value.purchaseQuantity !== "" |
| | | ) { |
| | | form.value.purchaseQuantity = toFixed( |
| | | parseFloat(form.value.purchaseQuantity), |
| | | 3 |
| | | ); // æ°éä¿ç3ä½å°æ° |
| | | } |
| | | }; |
| | | |
| | | onMounted(async () => { |
| | | let res = await userStore.getInfo() |
| | | let res = await userStore.getInfo(); |
| | | userInfo.value = res; |
| | | }) |
| | | }); |
| | | const rules = { |
| | | supplierName: [ |
| | | { required: true, message: "请è¾å
¥ä¾åºååç§°", trigger: "blur" }, |
| | |
| | | { required: true, message: "请è¾å
¥éè´æ°é", trigger: "blur" }, |
| | | { type: "number", message: "éè´æ°éå¿
须为æ°å", trigger: "blur" }, |
| | | ], |
| | | priceExcludingTax: [{ required: true, message: "请è¾å
¥åä»·", trigger: "blur" }], |
| | | totalPriceExcludingTax: [{ required: true, message: "请è¾å
¥æ»ä»·", trigger: "blur" }], |
| | | priceIncludingTax: [{ required: true, message: "请è¾å
¥å«ç¨åä»·", trigger: "blur" }], |
| | | totalPriceIncludingTax: [{ required: true, message: "请è¾å
¥å«ç¨æ»ä»·", trigger: "blur" }], |
| | | priceExcludingTax: [ |
| | | { required: true, message: "请è¾å
¥åä»·", trigger: "blur" }, |
| | | ], |
| | | totalPriceExcludingTax: [ |
| | | { required: true, message: "请è¾å
¥æ»ä»·", trigger: "blur" }, |
| | | ], |
| | | priceIncludingTax: [ |
| | | { required: true, message: "请è¾å
¥å«ç¨åä»·", trigger: "blur" }, |
| | | ], |
| | | totalPriceIncludingTax: [ |
| | | { required: true, message: "请è¾å
¥å«ç¨æ»ä»·", trigger: "blur" }, |
| | | ], |
| | | taxRate: [{ required: true, message: "请è¾å
¥ç¨ç", trigger: "blur" }], |
| | | registrantId: [{ required: true, message: "请è¾å
¥ç»è®°äºº", trigger: "blur" }], |
| | | registrationDate: [ |
| | |
| | | await formRef.value.validate(async (valid) => { |
| | | if (valid) { |
| | | const obj = ref({}); |
| | | if (props.title.includes('æ°å¢')) { |
| | | if (props.title.includes("æ°å¢")) { |
| | | let result = await addOrEditPR({ |
| | | ...form.value, |
| | | }) |
| | | }); |
| | | obj.value = { |
| | | title: "æ°å¢", |
| | | ...form.value, |
| | | result |
| | | result, |
| | | }; |
| | | } else { |
| | | delete form.value.updateTime |
| | | delete form.value.createTime |
| | | delete form.value.updateTime; |
| | | delete form.value.createTime; |
| | | let result = await addOrEditPR({ |
| | | ...form.value, |
| | | }) |
| | | }); |
| | | obj.value = { |
| | | title: "ç¼è¾", |
| | | ...form.value, |
| | | result |
| | | result, |
| | | }; |
| | | } |
| | | emit("submit", obj.value); |
| | |
| | | }; |
| | | </script> |
| | | |
| | | <style lang="sass" scoped> |
| | | </style> |
| | | <style lang="sass" scoped></style> |
| | |
| | | <div class="app-container"> |
| | | <el-form :inline="true" :model="queryParams" class="search-form"> |
| | | <el-form-item label="æç´¢"> |
| | | <el-input v-model="queryParams.searchText" placeholder="请è¾å
¥å
³é®è¯" clearable :style="{ width: '100%' }" /> |
| | | <el-input |
| | | v-model="queryParams.searchText" |
| | | placeholder="请è¾å
¥å
³é®è¯" |
| | | clearable |
| | | :style="{ width: '100%' }" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="ä¾åºååç§°"> |
| | | <el-input v-model="queryParams.supplierName" placeholder="请è¾å
¥" clearable :style="{ width: '100%' }" /> |
| | | <el-input |
| | | v-model="queryParams.supplierName" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | :style="{ width: '100%' }" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="ç»ä¸äººè¯å«å·"> |
| | | <el-input v-model="queryParams.identifyNumber" placeholder="请è¾å
¥" clearable :style="{ width: '100%' }" /> |
| | | <el-input |
| | | v-model="queryParams.identifyNumber" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | :style="{ width: '100%' }" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="ç»è¥å°å"> |
| | | <el-input v-model="queryParams.address" placeholder="请è¾å
¥" clearable :style="{ width: '100%' }" /> |
| | | <el-input |
| | | v-model="queryParams.address" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | :style="{ width: '100%' }" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleQuery">æ¥è¯¢</el-button> |
| | |
| | | <el-card> |
| | | <!-- æä½æé®åº --> |
| | | <el-row :gutter="24" class="table-toolbar"> |
| | | <el-button type="primary" :icon="Plus" @click="handleAdd">æ°å»º</el-button> |
| | | <el-button type="danger" :icon="Delete" @click="handleDelete">å é¤</el-button> |
| | | <el-button type="primary" :icon="Plus" @click="handleAdd" |
| | | >æ°å»º</el-button |
| | | > |
| | | <el-button type="danger" :icon="Delete" @click="handleDelete" |
| | | >å é¤</el-button |
| | | > |
| | | <!-- <el-button type="info" :icon="Download" @click="handleExport">导åº</el-button> --> |
| | | </el-row> |
| | | <!-- è¡¨æ ¼ç»ä»¶ --> |
| | | <data-table :loading="loading" :table-data="tableData" :columns="columns" @selection-change="handleSelectionChange" |
| | | @edit="handleEdit" @delete="handleDeleteSuccess" :show-selection="true" :border="true" :maxHeight="440" /> |
| | | <pagination v-if="total>0" :page="pageNum" :limit="pageSize" :total="total" @pagination="handlePagination" |
| | | :layout="'total, prev, pager, next, jumper'" /> |
| | | </el-card> <ProductionDialog v-model:copyForm="copyForm" v-model:dialogFormVisible="dialogFormVisible" v-model:form="form" :title="title" @submit="handleSubmit" |
| | | @success="handleSuccess" /> |
| | | <data-table |
| | | :loading="loading" |
| | | :table-data="tableData" |
| | | :columns="columns" |
| | | @selection-change="handleSelectionChange" |
| | | @edit="handleEdit" |
| | | @delete="handleDeleteSuccess" |
| | | :show-selection="true" |
| | | :border="true" |
| | | :maxHeight="440" |
| | | /> |
| | | <pagination |
| | | v-if="total > 0" |
| | | :page="current" |
| | | :limit="pageSize" |
| | | :total="total" |
| | | @pagination="handlePagination" |
| | | :layout="'total, prev, pager, next, jumper'" |
| | | /> |
| | | </el-card> |
| | | <ProductionDialog |
| | | v-model:copyForm="copyForm" |
| | | v-model:dialogFormVisible="dialogFormVisible" |
| | | v-model:form="form" |
| | | :title="title" |
| | | @submit="handleSubmit" |
| | | @success="handleSuccess" |
| | | ref="productionDialogs" |
| | | /> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | import { Plus, Edit, Delete, Download } from "@element-plus/icons-vue"; |
| | | import DataTable from "@/components/Table/ETable.vue"; |
| | | import Pagination from "@/components/Pagination"; |
| | | import ProductionDialog from './components/ProductionDialog.vue'; |
| | | import ProductionDialog from "./components/ProductionDialog.vue"; |
| | | import { purchaseRegistration } from "@/api/procureMent"; |
| | | import useUserStore from '@/store/modules/user' |
| | | import useDictStore from "@/store/modules/dict"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | // å¼å
¥åå
¸æ°æ® |
| | | const useDictStores = useDictStore(); |
| | | useDictStores.setDict({ |
| | | id: 1, |
| | | name: "ç
¤ç§ç±»å", |
| | | type: "coalType", |
| | | items: [ |
| | | { label: "æ çç
¤", value: "anthracite" }, |
| | | { label: "çç
¤", value: "bituminous" }, |
| | | { label: "è¤ç
¤", value: "lignite" } |
| | | ] |
| | | }) |
| | | console.log(useDictStores.dict); |
| | | |
| | | const { proxy } = getCurrentInstance() |
| | | const { proxy } = getCurrentInstance(); |
| | | const dialogFormVisible = ref(false); |
| | | const form = ref({}); |
| | | const title = ref(""); |
| | | // ç¶æåé |
| | | const loading = ref(false); |
| | | const total = ref(0); |
| | | const pageNum = ref(1) |
| | | const current = ref(1); |
| | | const pageSize = ref(10); |
| | | const selectedRows = ref([]); |
| | | const copyForm = ref({}); |
| | |
| | | supplierName: "", |
| | | identifyNumber: "", |
| | | address: "", |
| | | pageNum: 1, |
| | | pageSize: 10 |
| | | current: 1, |
| | | pageSize: 10, |
| | | }); |
| | | // æ¯å¦ç¼è¾ |
| | | const addOrEdit = ref("add"); |
| | |
| | | // è·åç¨æ·ä¿¡æ¯ |
| | | const userInfo = ref({}); |
| | | onMounted(async() => { |
| | | let res = await userStore.getInfo() |
| | | let res = await userStore.getInfo(); |
| | | userInfo.value = res.user; |
| | | }); |
| | | // å页å¤ç |
| | | const handlePagination = (val) => { |
| | | pageNum.value = val.page; |
| | | current.value = val.page; |
| | | pageSize.value = val.limit; |
| | | queryParams.pageNum = val.page; |
| | | queryParams.current = val.page; |
| | | queryParams.pageSize = val.limit; |
| | | getList(); |
| | | }; |
| | |
| | | // éç½®æ¥è¯¢ |
| | | const resetQuery = () => { |
| | | Object.keys(queryParams).forEach((key) => { |
| | | if (key !== "pageNum" && key !== "pageSize") { |
| | | if (key !== "current" && key !== "pageSize") { |
| | | queryParams[key] = ""; |
| | | } |
| | | }); |
| | |
| | | handleAddEdit(); |
| | | }; |
| | | // æ°å¢ç¼è¾ |
| | | const productionDialogs = ref(null); // æ·»å ref声æ |
| | | |
| | | const handleAddEdit = () => { |
| | | addOrEdit.value == "add" ? (title.value = "æ°å¢") : (title.value = "ç¼è¾"); |
| | | title.value = title.value + "éè´ä¿¡æ¯"; |
| | | |
| | | // æ£ç¡®ä½¿ç¨åç»ä»¶ref |
| | | if (productionDialogs.value) { |
| | | // è¿éå¯ä»¥è°ç¨åç»ä»¶çæ¹æ³ |
| | | console.log("åç»ä»¶å®ä¾:", productionDialogs.value.getDropdownData()); |
| | | } |
| | | |
| | | openDialog(); |
| | | }; |
| | | // æå¼å¼¹çª |
| | |
| | | // ç¡®ä¿å¤å¶ä¸ä»½æ°æ®ï¼é¿å
ç´æ¥å¼ç¨ |
| | | copyForm.value = JSON.parse(JSON.stringify(form.value)); |
| | | dialogFormVisible.value = true; |
| | | // 触åreféé¢çæ¹æ³ |
| | | return; |
| | | } |
| | | // æ°å»ºæ¶åå§å表å |
| | |
| | | totalPriceIncludingTax: "", |
| | | taxRate: "", |
| | | registrantId: userInfo.value.userName, |
| | | registrationDate: new Date().toISOString().split('T')[0] |
| | | registrationDate: new Date().toISOString().split("T")[0], |
| | | }; |
| | | // æ°å»ºæ¶ä¹éè¦è®¾ç½® copyForm ç¨äºéç½®åè½ |
| | | copyForm.value = JSON.parse(JSON.stringify(form.value)); |
| | |
| | | const handleEdit = (row) => { |
| | | form.value = JSON.parse(JSON.stringify(row)); |
| | | addOrEdit.value = "edit"; |
| | | handleAddEdit() |
| | | handleAddEdit(); |
| | | }; |
| | | const handleDelete = () => { |
| | | if (selectedRows.value.length === 0) { |
| | | ElMessage.warning("è¯·éæ©è¦å é¤çæ°æ®"); |
| | | return; |
| | | } |
| | | ElMessageBox.confirm( |
| | | `ç¡®å®å é¤éä¸çæ°æ®åï¼`, |
| | | "æç¤º", |
| | | { |
| | | ElMessageBox.confirm(`ç¡®å®å é¤éä¸çæ°æ®åï¼`, "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning" |
| | | } |
| | | ) |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | // 模æå é¤æä½ |
| | | tableData.value = tableData.value.filter( |
| | |
| | | .catch(() => { |
| | | ElMessage.info("已忶å é¤"); |
| | | }); |
| | | } |
| | | }; |
| | | const handleDeleteSuccess = (row) => { |
| | | ElMessage.success("å 餿åï¼" + row.supplierName); |
| | | }; |
| | | // å¯¼åº |
| | | const handleExport = (row) => { |
| | | proxy.download("system/post/export", { |
| | | ...queryParams.value |
| | | }, `post_${new Date().getTime()}.xlsx`) |
| | | proxy.download( |
| | | "system/post/export", |
| | | { |
| | | ...queryParams.value, |
| | | }, |
| | | `post_${new Date().getTime()}.xlsx` |
| | | ); |
| | | ElMessage.success("å¯¼åºæ°æ®ï¼" + row.supplierName); |
| | | }; |
| | | // æå |
| | |
| | | try { |
| | | // ä¼ éå页忰 |
| | | let res = await purchaseRegistration({ |
| | | pageNum: pageNum.value, |
| | | current: current.value, |
| | | pageSize: pageSize.value, |
| | | ...queryParams |
| | | ...queryParams, |
| | | }); |
| | | if (res && res.data) { |
| | | tableData.value = res.data.records || []; |
| | |
| | | > |
| | | <el-button type="primary" @click="handlData">éæ©æ°æ®</el-button> |
| | | <ETable |
| | | v-if="tableData.length > 0" |
| | | :columns="columns" |
| | | height="200" |
| | | @cell-edit="handleCellEdit" |
| | |
| | | /> |
| | | <div class="empty-table"> |
| | | <h1>ç产æç»</h1> |
| | | <el-row :gutter="10" v-if="tableData.length > 0"> |
| | | <el-row :gutter="10"> |
| | | <el-col :span="2"> |
| | | <el-button type="primary" @click="addNewRow"> |
| | | <el-icon> |
| | |
| | | </el-col> --> |
| | | </el-row> |
| | | <ProductionDetailsTable |
| | | v-if="tableData.length > 0" |
| | | v-model="detailsTableData" |
| | | :border="false" |
| | | :show-operations="true" |
| | |
| | | @input-change="handleDetailsChange" |
| | | @delete-row="handleDeleteRow" |
| | | /> |
| | | <div style="margin-top: 20px;" v-else>ææ æ°æ®ï¼è¯·éæ©é
ç½®æ°æ®</div> |
| | | |
| | | </div> |
| | | |
| | |
| | | { label: "æ¬æ¬¡ä½¿ç¨æ°é", prop: "used" }, |
| | | ]; |
| | | const detailsTableData = ref([ |
| | | { |
| | | coalType: "", |
| | | calorificValue: "", |
| | | productionQuantity: "", |
| | | laborCost: "", |
| | | energyCost: "", |
| | | equipmentDepreciation: "", |
| | | purchasePrice: "", |
| | | totalCost: "", |
| | | }, |
| | | |
| | | ]); |
| | | const handleRowClick = (row) => { |
| | | currentRow.value = row; |