From 2591e298a3fd1332ad0ca33059f6ba0b7d426f51 Mon Sep 17 00:00:00 2001 From: pengwei <2071057782@qq.com> Date: 星期四, 20 三月 2025 10:08:00 +0800 Subject: [PATCH] 最新代码提交 --- 项目代码/client/src/views/tts/BasicInformation/Basicinformation.vue | 522 ++++++++++++++++++++++++++++++++++----------------------- 1 files changed, 311 insertions(+), 211 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/client/src/views/tts/BasicInformation/Basicinformation.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/client/src/views/tts/BasicInformation/Basicinformation.vue" index a8e442c..628e2a6 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/client/src/views/tts/BasicInformation/Basicinformation.vue" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/client/src/views/tts/BasicInformation/Basicinformation.vue" @@ -39,21 +39,38 @@ size="small" /> </div> - <!-- <div class="serch_box"> - <div class="serchb">鍏ㄥ眬鎼滅储</div> + <div class="serch_box"> + <div class="serchb"> + <el-select + v-model="queryForm.selectType" + placeholder="璇烽�夋嫨" + size="small" + style="width: 100%; height: 100%; font-size: 0.15rem" + > + <el-option + v-for="item in selectoptions" + :key="item.value" + :label="item.label" + :value="item.value" + /> + </el-select> + </div> <input - v-model="queryForm.selectName" + v-model="queryForm.selectInput" placeholder="璇疯緭鍏ュ叧閿瘝鎼滅储" style="border-left: 0.06rem solid #e2e2e2" /> - </div> --> + </div> <el-button type="primary" size="small" style="margin-left: 0.98rem; height: 2rem" + @click="handleQuery" >鏌ヨ</el-button > - <el-button size="small" style="height: 2rem">閲嶇疆</el-button> + <el-button size="small" style="height: 2rem" @click="resetQuery" + >閲嶇疆</el-button + > </div> <div class="btns"> <div style="display: flex; align-items: center"> @@ -70,7 +87,7 @@ display: flex; align-items: center; " - ><el-icon style="margin-right: 0.2rem"><Plus /></el-icon + ><el-icon style="margin-right: 0.2rem"> <Plus /> </el-icon >鏂板缓</el-button > <!-- 宸ュ叿鍒楄〃鏂板缓 --> @@ -86,7 +103,7 @@ display: flex; align-items: center; " - ><el-icon style="margin-right: 0.2rem"><Plus /></el-icon + ><el-icon style="margin-right: 0.2rem"> <Plus /> </el-icon >鏂板缓</el-button > <el-button @@ -131,7 +148,7 @@ <el-table-column prop="articleName" label="淇℃伅鍚嶇О" align="center" /> <el-table-column prop="articleType" label="瑙勬牸鍨嬪彿" align="center" /> <el-table-column prop="articleUnit" label="鍗曚綅" align="center" /> - <el-table-column prop="category" label="鎵�灞炲垎绫�" align="center" /> + <!-- <el-table-column prop="category" label="鎵�灞炲垎绫�" align="center" /> --> <el-table-column prop="createDate" label="鍒涘缓鏃ユ湡" align="center" /> <el-table-column label="鎿嶄綔" align="center"> <template #default="scope"> @@ -169,7 +186,7 @@ align="center" /> <el-table-column prop="toolUnit" label="鍗曚綅" align="center" /> - <el-table-column prop="" label="鎵�灞炲垎绫�" align="center" /> + <!-- <el-table-column prop="" label="鎵�灞炲垎绫�" align="center" /> --> <el-table-column prop="toolremark" label="澶囨敞" align="center" /> <el-table-column prop="createtime" label="鍒涘缓鏃ユ湡" align="center" /> <el-table-column prop="address" label="鎿嶄綔" align="center"> @@ -213,6 +230,7 @@ :before-close="handleClose" :show-close="false" :align-center="true" + @close="resetForm(formRef)" > <template #title> <div @@ -228,10 +246,17 @@ > </div> </template> - <el-form :model="forminfo" label-width="auto" label-position="top"> + <el-form + :model="forminfo" + label-width="auto" + label-position="top" + :rules="rules" + ref="formRef" + :hide-required-asterisk="true" + > <el-row :gutter="20"> <el-col :span="8"> - <el-form-item> + <el-form-item prop="articleName"> <template #label> <div style="display: flex; align-items: flex-end"> <span style="color: red; margin-right: 0.2rem">*</span> @@ -249,7 +274,7 @@ </el-form-item> </el-col> <el-col :span="8"> - <el-form-item> + <el-form-item prop="articleType"> <template #label> <div style="display: flex; align-items: flex-end"> <span style="color: red; margin-right: 0.2rem">*</span> @@ -267,7 +292,7 @@ </el-form-item> </el-col> <el-col :span="8"> - <el-form-item> + <el-form-item prop="articleUnit"> <template #label> <div style="display: flex; align-items: flex-end"> <span style="color: red; margin-right: 0.2rem">*</span> @@ -286,34 +311,8 @@ </el-col> </el-row> <el-row :gutter="20"> - <el-col :span="8"> - <el-form-item> - <template #label> - <div style="display: flex; align-items: flex-end"> - <span style="color: red; margin-right: 0.2rem">*</span> - <span - style="font-size: 0.88rem; color: black; font-weight: bold" - >鎵�灞炲垎绫�</span - > - </div> - </template> - <el-input - size="small" - v-model="forminfo.category" - placeholder="璇疯緭鍏�" - /> - <!-- <el-select v-model="value" placeholder="璇烽�夋嫨" size="small"> - <el-option - v-for="item in options" - :key="item.value" - :label="item.label" - :value="item.value" - /> - </el-select> --> - </el-form-item> - </el-col> <el-col :span="16"> - <el-form-item> + <el-form-item prop="articleRemark"> <template #label> <div style="display: flex; align-items: flex-end"> <span style="color: red; margin-right: 0.2rem">*</span> @@ -344,7 +343,7 @@ <el-button size="small" type="primary" - @click="CreateInformation" + @click="CreateInformation(formRef)" style="height: 2rem; font-size: 0.88rem" > 淇濆瓨 @@ -361,6 +360,7 @@ :before-close="handleClose" :show-close="false" :align-center="true" + @close="resetForm(ruleFormRef)" > <template #title> <div @@ -376,10 +376,17 @@ > </div> </template> - <el-form :model="formtool" label-width="auto" label-position="top"> + <el-form + :model="formtool" + label-width="auto" + label-position="top" + ref="ruleFormRef" + :rules="toolRules" + :hide-required-asterisk="true" + > <el-row :gutter="20"> <el-col :span="8"> - <el-form-item> + <el-form-item prop="toolName"> <template #label> <div style="display: flex; align-items: flex-end"> <span style="color: red; margin-right: 0.2rem">*</span> @@ -397,7 +404,7 @@ </el-form-item> </el-col> <el-col :span="8"> - <el-form-item> + <el-form-item prop="specification"> <template #label> <div style="display: flex; align-items: flex-end"> <span style="color: red; margin-right: 0.2rem">*</span> @@ -415,7 +422,7 @@ </el-form-item> </el-col> <el-col :span="8"> - <el-form-item> + <el-form-item prop="toolUnit"> <template #label> <div style="display: flex; align-items: flex-end"> <span style="color: red; margin-right: 0.2rem">*</span> @@ -434,34 +441,8 @@ </el-col> </el-row> <el-row :gutter="20"> - <el-col :span="8"> - <el-form-item> - <template #label> - <div style="display: flex; align-items: flex-end"> - <span style="color: red; margin-right: 0.2rem">*</span> - <span - style="font-size: 0.88rem; color: black; font-weight: bold" - >鎵�灞炲垎绫�</span - > - </div> - </template> - <el-input - size="small" - v-model="formtool.category" - placeholder="璇疯緭鍏�" - /> - <!-- <el-select v-model="value" placeholder="璇烽�夋嫨" size="small"> - <el-option - v-for="item in options" - :key="item.value" - :label="item.label" - :value="item.value" - /> - </el-select> --> - </el-form-item> - </el-col> <el-col :span="16"> - <el-form-item> + <el-form-item prop="toolremark"> <template #label> <div style="display: flex; align-items: flex-end"> <span style="color: red; margin-right: 0.2rem">*</span> @@ -492,7 +473,7 @@ <el-button size="small" type="primary" - @click="addToolApi" + @click="addToolApi(ruleFormRef)" style="height: 2rem; font-size: 0.88rem" > 淇濆瓨 @@ -503,7 +484,7 @@ </div> </template> <script setup> -import { ref, reactive, onMounted } from "vue"; +import { ref, reactive, onMounted, toRef } from "vue"; import { ElMessage, ElMessageBox } from "element-plus"; import { formatTime } from "@/utils/index.js"; import { @@ -516,45 +497,91 @@ deleteToolData, deleteBasicinformation, } from "@/api/newapi/Basicinformation.js"; - -const queryForm = reactive({ +// 鍒濆鍖栨暟鎹� +const obj = { selectName: "", selectTime: [], // 鏃堕棿鑼冨洿 -}); + selectType: "", //閫夋嫨鐨勭被鍨� + selectInput: "", //杈撳叆鐨勬暟鎹� +}; +//鎼滅储浼犵殑鏁版嵁 +const queryForm = toRef({ ...obj }); const tableData = ref([]); -const options = ref([]); -const props = { multiple: true }; -const table = ref(false); +const toolList = ref([]); + +const isactive = ref(1); +const dialogVisible = ref(false); +const dialogVisible1 = ref(false); + +const selectoptions = ref([]); +const infoOpitions = ref([ + { + value: "articleName", + label: "淇℃伅鍚嶇О", + }, + { + value: "articleType", + label: "瑙勬牸鍨嬪彿", + }, +]); + +const toolsOpitions = ref([ + { + value: "toolName", + label: "宸ュ叿鍚嶇О", + }, + { + value: "specification", + label: "瑙勬牸鍨嬪彿", + }, +]); + const forminfo = ref({ articleName: "", articleType: "", articleUnit: "", - category: "", articleremark: "", - createDate: formatTime(new Date()), + createDate: formatTime(new Date()), //鍒涘缓鏃堕棿 + creater: JSON.parse(localStorage.getItem("user")).userName, //鍒涘缓浜� }); -const isactive = ref(1); -const claimdialogVisible = ref(false); -const dialogVisible = ref(false); -const dialogVisible1 = ref(false); -const TorquedialogVisible = ref(false); -const toolList = ref([]); const formtool = ref({ toolName: "", specification: 0, toolUnit: "", toolremark: "", - createtime: formatTime(new Date()), + createDate: formatTime(new Date()), //鍒涘缓鏃堕棿 + creater: JSON.parse(localStorage.getItem("user")).userName, //鍒涘缓浜� + modifier: JSON.parse(localStorage.getItem("user")).userName, //淇敼浜� + modifyDate: formatTime(new Date()), //淇敼鏃堕棿 }); + +const toolRules = reactive({ + toolName: [{ required: true, message: "璇疯緭鍏ュ伐鍏峰悕绉�", trigger: "blur" }], + specification: [{ required: true, message: "璇疯緭鍏ヨ鏍�", trigger: "blur" }], + toolUnit: [{ required: true, message: "璇疯緭鍏ュ崟浣�", trigger: "blur" }], + toolremark: [{ required: true, message: "璇疯緭鍏ュ娉�", trigger: "blur" }], +}); +const rules = reactive({ + articleName: [{ required: true, message: "璇疯緭鍏ュ伐鍏峰悕绉�", trigger: "blur" }], + articleType: [{ required: true, message: "璇疯緭鍏ヨ鏍�", trigger: "blur" }], + articleUnit: [{ required: true, message: "璇疯緭鍏ュ崟浣�", trigger: "blur" }], + articleremark: [{ required: true, message: "璇疯緭鍏ュ娉�", trigger: "blur" }], +}); +const ruleFormRef = ref(); +const formRef = ref(); +//鏀瑰彉鐘舵�� +selectoptions.value = infoOpitions.value; const changeactive = (index) => { isactive.value = index; - if (index == 1) { - initData(); + if (isactive.value == 1) { + selectoptions.value = infoOpitions.value; } else { - getTool(); + selectoptions.value = toolsOpitions.value; } + initData(); }; const infoType = ref("鏂板缓"); + const Useradd = () => { infoType.value = "鏂板缓"; dialogVisible.value = true; @@ -567,90 +594,35 @@ }; //鏂板缓淇℃伅鍒楄〃 -const CreateInformation = () => { - if (infoType.value == "鏂板缓") { - addBasicinformation(forminfo.value).then((res) => { - ElMessage({ - message: "鏂板缓鎴愬姛", - type: "success", - }); - dialogVisible.value = false; - initData(); - }); - } else { - editBasicinformation(forminfo.value).then((res) => { - ElMessage({ - message: "淇敼鎴愬姛", - type: "success", - }); - dialogVisible.value = false; - initData(); - }); - } -}; -// 鏌ョ湅鍔涚煩 -const Findtorque = () => { - TorquedialogVisible.value = true; -}; - -//鍒嗛〉璇锋眰鍙傛暟 -const pageQuery = ref({ - page: 1, //褰撳墠椤甸潰 - rows: 10, //姣忛〉鏄剧ず鏉℃暟 - order: "desc", //鎺掑簭鏂瑰紡 - sort: "createDate", //鎺掑簭瀛楁 - wheres: "", //鏉′欢鏌ヨ -}); - -//鍒嗛〉椤甸潰澶у皬鏀瑰彉 -const handleSizeChange = (val) => { - pageQuery.value.rows = val; - initData(); -}; - -//鍒嗛〉椤甸潰鏀瑰彉 -const handleCurrentChange = (val) => { - pageQuery.value.page = val; - initData(); -}; -const pageTotal = ref(0); -const initData = () => { - // 鏌ヨ鏉′欢 - const startTime = formatTime(queryForm.selectTime[0]); - const endTime = formatTime(queryForm.selectTime[1]); - const filter = [ - { - name: "grouptype", - value: queryForm.selectType, - displayType: "String", - }, - { - name: "pustatus", - value: queryForm.selectName, - displayType: "String", - }, - { name: "dispatchtime", value: startTime, displayType: "ThanOrEqual" }, - { name: "dispatchtime", value: endTime, displayType: "LessOrEqual" }, - ]; - getBasicinformation({ - ...pageQuery.value, - filter, - }).then((res) => { - tableData.value = res.rows; - pageTotal.value = res.total; +const CreateInformation = async (formEl) => { + if (!formEl) return; + await formEl.validate((valid, fields) => { + if (valid) { + if (infoType.value == "鏂板缓") { + addBasicinformation(forminfo.value).then((res) => { + ElMessage({ + message: "鏂板缓鎴愬姛", + type: "success", + }); + dialogVisible.value = false; + initData(); + }); + } else { + editBasicinformation(forminfo.value).then((res) => { + ElMessage({ + message: "淇敼鎴愬姛", + type: "success", + }); + dialogVisible.value = false; + initData(); + }); + } + } else { + console.log("error submit!", fields); + } }); }; -//鏁版嵁妫�绱簨浠� -const handleQuery = () => { - pageQuery.value.page = 1; - initData(); -}; -const resetQuery = () => { - queryForm.value = { selectName: "鍏ㄩ儴鐘舵��", selectTime: [] }; - pageQuery.value.page = 1; - initData(); -}; const toolType = ref("鏂板缓"); const addTool = () => { toolType.value = "鏂板缓"; @@ -661,47 +633,53 @@ formtool.value = data; toolType.value = "缂栬緫"; dialogVisible1.value = true; - console.log(formtool.value); }; //鏂板缓宸ュ叿 -const addToolApi = () => { - if (toolType.value == "鏂板缓") { - addToolData(formtool.value).then((res) => { - ElMessage({ - message: "鏂板缓鎴愬姛", - type: "success", - }); - dialogVisible1.value = false; - getTool(); - }); - } else { - editToolData(formtool.value).then((res) => { - ElMessage({ - message: "淇敼鎴愬姛", - type: "success", - }); - dialogVisible1.value = false; - getTool(); - }); - } +const addToolApi = async (formEl) => { + if (!formEl) return; + await formEl.validate((valid, fields) => { + if (valid) { + if (toolType.value == "鏂板缓") { + addToolData(formtool.value).then((res) => { + ElMessage({ + message: "鏂板缓鎴愬姛", + type: "success", + }); + dialogVisible1.value = false; + initData(); + }); + } else { + editToolData(formtool.value).then((res) => { + ElMessage({ + message: "淇敼鎴愬姛", + type: "success", + }); + dialogVisible1.value = false; + initData(); + }); + } + } else { + console.log("error submit!", fields); + } + }); }; //鑾峰彇宸ュ叿琛ㄤ俊鎭� -const getTool = () => { - const startTime = formatTime(queryForm.selectTime[0]); - const endTime = formatTime(queryForm.selectTime[1]); - const filter = [ - { name: "dispatchtime", value: startTime, displayType: "ThanOrEqual" }, - { name: "dispatchtime", value: endTime, displayType: "LessOrEqual" }, - ]; - getToolData({ - ...pageQuery.value, - filter, - }).then((res) => { - toolList.value = res.rows; - pageTotal.value = res.total; - }); -}; +// const getTool = () => { +// const startTime = formatTime(queryForm.value.selectTime[0]); +// const endTime = formatTime(queryForm.value.selectTime[1]); +// const filter = [ +// { name: "dispatchtime", value: startTime, displayType: "ThanOrEqual" }, +// { name: "dispatchtime", value: endTime, displayType: "LessOrEqual" }, +// ]; +// getToolData({ +// ...pageQuery.value, +// filter, +// }).then((res) => { +// toolList.value = res.rows; +// pageTotal.value = res.total; +// }); +// }; //鎵归噺鍒犻櫎 const ids = ref([]); const InfoSelectionChange = (val) => { @@ -725,9 +703,115 @@ } else { deleteToolData(ids.value).then((res) => { ElMessage({ message: "鍒犻櫎鎴愬姛", type: "success" }); - getTool(); + initData(); }); } +}; + +//鍒嗛〉璇锋眰鍙傛暟 +const pageQuery = ref({ + page: 1, //褰撳墠椤甸潰 + rows: 10, //姣忛〉鏄剧ず鏉℃暟 + order: "desc", //鎺掑簭鏂瑰紡 + sort: "createDate", //鎺掑簭瀛楁 + wheres: "", //鏉′欢鏌ヨ +}); + +//鍒嗛〉椤甸潰澶у皬鏀瑰彉 +const handleSizeChange = (val) => { + pageQuery.value.rows = val; + initData(); +}; + +//鍒嗛〉椤甸潰鏀瑰彉 +const handleCurrentChange = (val) => { + pageQuery.value.page = val; + initData(); +}; +const pageTotal = ref(0); +//鍒濆鍖栨暟鎹� +const initData = () => { + // 鏌ヨ鏉′欢 + const startTime = formatTime(queryForm.value.selectTime[0]); + const endTime = formatTime(queryForm.value.selectTime[1]); + const filter = [ + { + name: "grouptype", + value: queryForm.value.selectType, + displayType: "String", + }, + { + name: queryForm.value.selectType, + value: queryForm.value.selectInput, + displayType: "like", + }, + { + name: "pustatus", + value: queryForm.value.selectName, + displayType: "String", + }, + { name: "dispatchtime", value: startTime, displayType: "ThanOrEqual" }, + { name: "dispatchtime", value: endTime, displayType: "LessOrEqual" }, + ]; + if (isactive.value == 1) { + getBasicinformation({ + ...pageQuery.value, + filter, + }).then((res) => { + tableData.value = res.rows; + pageTotal.value = res.total; + }); + } else { + getToolData({ + ...pageQuery.value, + filter, + }).then((res) => { + toolList.value = res.rows; + pageTotal.value = res.total; + }); + } +}; + +//鏁版嵁妫�绱簨浠� +const handleQuery = () => { + pageQuery.value.page = 1; + initData(); +}; +//閲嶇疆鏂规硶 +const resetQuery = () => { + queryForm.value = Object.assign({}, obj); + pageQuery.value.page = 1; + initData(); +}; + +//閲嶇疆琛ㄥ崟 +const resetForm = (formEl) => { + if (!formEl) return; + formEl.resetFields(); + forminfo.value = Object.assign( + {}, + { + articleName: "", + articleType: "", + articleUnit: "", + articleremark: "", + createDate: formatTime(new Date()), //鍒涘缓鏃堕棿 + creater: JSON.parse(localStorage.getItem("user")).userName, //鍒涘缓浜� + } + ); + formtool.value = Object.assign( + {}, + { + toolName: "", + specification: 0, + toolUnit: "", + toolremark: "", + createDate: formatTime(new Date()), //鍒涘缓鏃堕棿 + creater: JSON.parse(localStorage.getItem("user")).userName, //鍒涘缓浜� + modifier: JSON.parse(localStorage.getItem("user")).userName, //淇敼浜� + modifyDate: formatTime(new Date()), //淇敼鏃堕棿 + } + ); }; onMounted(() => { @@ -738,16 +822,19 @@ .Basicinformation { display: flex; background-color: #fff; + .content { width: 100%; display: flex; flex-direction: column; + .checkbox { width: 11rem; display: flex; justify-content: space-between; margin-top: 1rem; margin-left: 1.31rem; + .item { width: 5rem; height: 1.88rem; @@ -759,20 +846,24 @@ line-height: 1.88rem; cursor: pointer; } + .isactive { background-color: rgba(16, 16, 16, 1); color: rgba(255, 255, 255, 1); } } + .serch { display: flex; margin-top: 1.31rem; align-items: center; + .time_box { display: flex; align-items: center; text-align: center; margin-left: 0.98rem; + .time { box-sizing: border-box; width: 6.88rem; @@ -786,24 +877,26 @@ justify-content: center; } } + .serch_box { display: flex; align-items: center; text-align: center; margin-left: 0.98rem; border-radius: 0.38rem; + .serchb { box-sizing: border-box; width: 6.88rem; height: 2rem; text-align: center; - border: 0.06rem solid rgba(222, 222, 222, 1); border-radius: 0.25rem 0 0 0.25rem; font-size: 0.75rem; display: flex; align-items: center; justify-content: center; } + input { box-sizing: border-box; outline: none; @@ -816,6 +909,7 @@ } } } + .btns { display: flex; justify-content: space-between; @@ -826,17 +920,20 @@ box-sizing: border-box; } } + .my-header { height: 3.84rem; display: flex; justify-content: space-between; border-bottom: 0.06rem solid rgba(233, 233, 233, 1); } + .avatar-uploader .avatar { width: 7rem; height: 7rem; display: block; } + :deep(.avatar-uploader .el-upload) { width: 7rem; height: 7rem; @@ -847,10 +944,12 @@ overflow: hidden; transition: var(--el-transition-duration-fast); } + :deep(.el-upload-list__item) { width: 7rem; height: 7rem; } + .avatar-uploader .el-upload:hover { border-color: var(--el-color-primary); } @@ -868,6 +967,7 @@ .confirmButtonClass { margin-right: 10px; } + .el-message-box .el-message-box__btns { flex-direction: row-reverse !important; justify-content: normal !important; -- Gitblit v1.9.3