From 1308d4d7a162d3cabd0fe4f639b6d7f5dd376584 Mon Sep 17 00:00:00 2001 From: wyg <wu1555611@163.com> Date: 星期二, 18 六月 2024 09:30:18 +0800 Subject: [PATCH] '基础数据仓库初次提交' --- src/api/basicData/warehouse.js | 4 src/views/basicData/locationGroup/addModal.vue | 294 +++ src/views/basicData/warehouse/info.data.js | 263 ++ src/variableSet/checkTaskItem.js | 22 src/components/Table/index.vue | 480 +++++ src/views/basicData/warehouse/addModal.vue | 247 ++ src/views/basicData/warehouse/linshi.vue | 425 ++++ src/components/Table/BaseSearch.vue | 226 ++ src/views/basicData/location/addModal.vue | 283 +++ src/views/basicData/location/info.data.js | 338 +++ src/views/basicData/locationGroup/index.vue | 592 ++---- src/api/basicData/location.js | 22 src/components/Table/mixins/resize.js | 29 src/views/basicData/locationGroup/info.data.js | 278 +++ src/views/basicData/location/index.vue | 777 ++++++++ src/variableSet/columns.js | 83 src/views/basicData/locationGroup/linshi.vue | 410 ++++ src/views/basicData/warehouse/index.vue | 606 ++---- 18 files changed, 4,573 insertions(+), 806 deletions(-) diff --git a/src/api/basicData/location.js b/src/api/basicData/location.js index 0c08dcb..0f42a14 100644 --- a/src/api/basicData/location.js +++ b/src/api/basicData/location.js @@ -42,3 +42,25 @@ method: 'delete' }) } + + + + +// 鏌ヨ宸ュ巶浠撳簱鍒楄〃 +export function listWaresList() { + return request({ + url: 'system/warehouse/listWerks', + method: 'get', + }) +} + + + +// 鏌ヨ宸ュ巶鍒楄〃 +export function listwerkshouse(query) { + return request({ + url: '/system/werks/list', + method: 'get', + params: query + }) +} \ No newline at end of file diff --git a/src/api/basicData/warehouse.js b/src/api/basicData/warehouse.js index 03326e9..f15b400 100644 --- a/src/api/basicData/warehouse.js +++ b/src/api/basicData/warehouse.js @@ -42,3 +42,7 @@ method: 'delete' }) } + + + + diff --git a/src/components/Table/BaseSearch.vue b/src/components/Table/BaseSearch.vue new file mode 100644 index 0000000..ce4c4fa --- /dev/null +++ b/src/components/Table/BaseSearch.vue @@ -0,0 +1,226 @@ +<template> + <div class="dialog-search"> + <el-form + :inline="true" + ref="ruleForm" + :model="formInline" + class="demo-form-inline" + v-show="showSearch" + > + <el-form-item + v-for="(item, index) in formItemListData" + :key="index" + :label="item.label" + > + <!-- 涓嬫媺閫夋嫨妗� --> + <template v-if="item.component == 'Select'"> + <template v-if="item.slot"> + <slot :name="item.slot" :form="formInline" :field="item.field"> + </slot> + </template> + <template v-else> + <el-select + v-model="formInline[item.field]" + :multiple="item.multiple" + :placeholder="item.componentProps.placeholder" + size="mini" + clearable + > + <el-option + v-for="(item2, index2) in item.selectOptions" + size="mini" + :key="index2" + :label="item2.label" + :value="item2.value" + ></el-option> + </el-select> + </template> + </template> + + <!-- 涓嬫媺閫夋嫨妗唀nd --> + <!-- 杈撳叆妗� --> + <el-input + v-if="item.component == 'Input' && item.show !== false" + v-model.trim="formInline[item.field]" + :placeholder="item.componentProps.placeholder" + clearable + size="mini" + ></el-input> + <!-- 杈撳叆妗� --> + <!-- 鏃ユ湡鑼冨洿閫夋嫨妗� --> + <el-date-picker + v-if=" + item.component == 'daterange' || + item.component == 'datetimerange' || + item.component == 'date' || + item.component == 'datetime' + " + size="mini" + v-model="formInline[item.field]" + :value-format="item.valueFormat || 'yyyy/MM/dd'" + :format="item.format || 'yyyy/MM/dd'" + clearable + :type="item.component || ''" + :range-separator="item.rangeSeparator || '鑷�'" + :start-placeholder="item.componentProps.startPlaceholder" + :end-placeholder="item.componentProps.endPlaceholder" + :placeholder="item.componentProps.placeholder" + > + </el-date-picker> + <!-- 鏃ユ湡鑼冨洿閫夋嫨妗唀nd --> + <!-- 绾ц仈閫夋嫨鍣� --> + <el-cascader + v-if="item.component == 'cascader'" + v-model="formInline[item.field]" + :options="item.options" + :props="item.props" + size="mini" + clearable + ></el-cascader> + <!-- 绾ц仈閫夋嫨鍣╡nd --> + </el-form-item> + + <slot name="formItem"></slot> + <el-form-item style="width: 10rem"> + <el-button type="primary" size="mini" @click="onSubmit">鏌ヨ</el-button> + <el-button type="" size="mini" @click="resetForm('ruleForm')" + >閲嶇疆</el-button + > + </el-form-item> + <!-- 鍙敤浜庢樉绀哄叾浠栨寜閽� --> + <slot name="formButton"></slot> + </el-form> + <el-row :gutter="10" class="mb8"> + <div class="bottonBox"> + <slot name="actionButton"></slot> + <right-toolbar + :showSearch.sync="showSearch" + @queryTable="getList" + class="rightbotton" + ></right-toolbar> + </div> + </el-row> + </div> +</template> + +<script> +import request from "@/utils/request"; +import { time } from "echarts"; + +export default { + name: "BaseSearch", + props: { + emitSearch: { + // 鏄惁绔嬪嵆鎵ц鎼滅储 + type: Boolean, + default: false, + }, + formItemList: { + type: Array, + default() { + return []; + }, + }, + }, + data() { + let formInline = {}; + for (const obj of this.formItemList) { + formInline[obj.field] = obj.defaultValue || ""; + } + return { + formInline, + showSearch: true, + // formItemListData: [], + }; + }, + computed: { + formItemListData() { + return JSON.parse(JSON.stringify(this.formItemList)).map((item) => { + if (item.component == "Select" && !item.slot) { + if (item.componentProps.options) { + item.selectOptions = item.componentProps.options; + } + } + + return item; + }); + }, + }, + mounted() {}, + watch: { + emitSearch(newVal, oldVal) { + // 鏄惁绔嬪嵆瑙﹀彂鎼滅储 鐢ㄥ湪寮圭獥涓紓姝ヨ姹備笅鎷夋鍚� 鎴栬�呯粰涓嬫媺妗嗚祴鍊奸粯璁ゅ�煎悗 闇�瑕佺敤鍒拌繖涓柟娉� + if (newVal) { + console.log("姝ゆ椂瑙﹀彂--绔嬪嵆鎵ц鎼滅储"); + this.$emit("search", this.formInline); + } + }, + formItemList: { + handler(newVal, oldVal) { + for (const obj of this.formItemList) { + console.log(obj); + if (obj.defaultValue) { + formInline[obj.field] = obj.defaultValue; + } + } + }, + deep: true, + }, + showSearch() { + this.$emit("showSearchChange"); + }, + }, + methods: { + onSubmit() { + this.$emit("search", this.formInline); + }, + resetForm(formName) { + this.$refs[formName].resetFields(); + let formInline = {}; + for (const obj of this.formItemList) { + formInline[obj.field] = ""; // 鎵�鏈夌瓫閫夋潯浠舵竻绌� + } + this.formInline = formInline; + + this.$emit("search", this.formInline); + }, + getList() { + this.$emit("getList"); + }, + }, +}; +</script> + +<style lang="scss" scoped> +.dialog-search { + // margin: 0 1rem; + margin-bottom: 20px; + text-align: left; + ::v-deep .el-form-item__content { + // width: 16rem; + .el-input { + width: 16rem; + } + .el-select { + .el-input__inner { + // height: 3.2rem; + width: 16rem; + } + } + } + ::v-deep .el-form-item { + margin-bottom: 5px; + } +} +.bottonclas { + display: flex; + justify-content: flex-start; +} +.bottonBox { + display: flex; + justify-content: flex-start; +} +.rightbotton { + margin-left: 20px; +} +</style> diff --git a/src/components/Table/index.vue b/src/components/Table/index.vue new file mode 100644 index 0000000..8f7fb07 --- /dev/null +++ b/src/components/Table/index.vue @@ -0,0 +1,480 @@ +<template> + <el-table + ref="multipleTable" + v-loading="tableLoading" + :data="tableData" + element-loading-text="鎷煎懡鍔犺浇涓�" + :height="elementHeight" + :key='elementHeight' + element-loading-spinner="el-icon-loading" + element-loading-background="rgba(255, 255, 255, 0.2)" + tooltip-effect="dark" + style="width: 100%" + border + :row-class-name="rowClassName" + :header-cell-style="headerCellStyle" + stripe + cell-class-name="cellClassName" + :row-key="isTree ? rowKey : ''" + @expand-change="expandChange" + @select="selectchange" + @select-all="selectAll" + > + <template v-if="isSelection"> + <el-table-column type="selection" width="55" /> + </template> + + <template v-for="(item, index) in column"> + <el-table-column + :key="index" + :label="item.label" + :prop="item.prop" + :type="item.type" + :width="item.width" + :fixed="item.fixed" + :sortable="item.sortable ? true : false" + :filters="item.filters" + :column-key="item.columnKey" + :filtered-value="item.filteredValue" + :filter-multiple="item.filterMultiple" + :min-width="item.minWidth" + :align="item.align" + :show-overflow-tooltip="true" + > + <!-- <div class="123" v-if="item.type == ''"> --> + <template + v-if="item.hasOwnProperty('colunmTemplate')" + :slot="item.colunmTemplate" + slot-scope="scope" + > + <slot + v-if="item.theadSlot" + :name="item.theadSlot" + :row="scope.row" + :index="index" + /> + </template> + + <template slot-scope="scope"> + <!-- 鎻掓Ы --> + <div v-if="item.dataType == 'slot'"> + <slot + v-if="item.slot" + :name="item.slot" + :row="scope.row" + :index="scope.$index" + /> + </div> + + <!-- 杩涘害鏉� --> + <div v-else-if="item.dataType == 'progress'"> + <el-progress :percentage="Number(scope.row[item.prop])" /> + </div> + + <!-- tag --> + <div v-else-if="item.dataType == 'tag'"> + <el-tag + v-if=" + typeof dataTypeFn(scope.row[item.prop], item.formatData) == + 'string' + " + :title="scope.row[item.prop] | formatters(item.formatData)" + :type="formatType(scope.row[item.prop], item.formatType)" + > + {{ scope.row[item.prop] | formatters(item.formatData) }} + </el-tag> + + <el-tag + v-for="(tag, index) in dataTypeFn( + scope.row[item.prop], + item.formatData + )" + v-else-if=" + typeof dataTypeFn(scope.row[item.prop], item.formatData) == + 'object' + " + :key="index" + :title="scope.row[item.prop] | formatters(item.formatData)" + :type="formatType(tag, item.formatType)" + > + {{ + item.tagGroup + ? tag[item.tagGroup.label] + ? tag[item.tagGroup.label] + : tag + : tag + }} + </el-tag> + + <el-tag + v-else + :title="scope.row[item.prop] | formatters(item.formatData)" + :type="formatType(scope.row[item.prop], item.formatType)" + > + {{ scope.row[item.prop] | formatters(item.formatData) }} + </el-tag> + </div> + + <!-- 鎸夐挳 --> + <div v-else-if="item.dataType == 'option'"> + <template > + <el-button + v-for="(o, key) in item.operation" + v-show="o.showHide ? o.showHide(scope.row) : true" + :key="key" + :icon="o.icon | iconFn(scope.row)" + :disabled="o.disabled ? o.disabled(scope.row) : false" + :plain="o.plain" + :type="o.type | typeFn(scope.row)" + :size="o.size" + @click="clickFun(scope.row, o.typeText)" + v-hasPermi="[o.hasPermi]" + > + {{ o.name }} + 銆�銆�銆�銆�銆� + </el-button> + </template> + </div> + + <!-- --> + + <!-- 榛樿绾睍绀烘暟鎹� --> + <span v-else> + <span class="overClass" v-if="!item.formatData"> + {{ scope.row[item.prop] }} + </span> + <span class="overClass" v-else> + {{ scope.row[item.prop] | formatters(item.formatData) }} + </span> + </span> + </template> + + <!-- </div> --> + </el-table-column> + </template> + </el-table> +</template> + +<script> +export default { + filters: { + iconFn(val, row) { + if (typeof val === "function") { + return val(row); + } else return val; + }, + typeFn(val, row) { + if (typeof val === "function") { + return val(row); + } else return val; + }, + describeConts(val, describeCont) { + if (typeof describeCont === "function") { + return describeCont(val); + } else return val; + }, + formatters(val, format) { + if (typeof format === "function") { + return format(val); + } else return val; + }, + }, + props: { + // 鏄惁寮�鍚閫� + isSelection: { + type: Boolean, + default: false, + }, + // 璁剧疆琛ㄦ牸楂樺害 + height: { + type: Number|String, + default: null, + }, + // 琛ㄦ牸鏁版嵁璇锋眰loading + tableLoading: { + type: Boolean, + default: false, + }, + // 琛ㄦ牸澶撮儴鏍峰紡 + headerCellStyle: { + type: Object, + default: () => { + return {}; + }, + }, + // 鍒楁暟鎹〃澶� + column: { + type: Array, + default() { + return []; + }, + }, + // 琛屾暟鎹被鍚� + rowClassName: { + type: Function, + default: () => {}, + }, + // 琛ㄦ牸鏁版嵁 + tableData: { + type: Array, + default() { + return []; + }, + }, + // 鍦ㄦ槸鏍戠姸琛ㄦ牸鏃堕渶瑕佷娇鐢╮owKey榛樿涓嶄娇鐢� + isTree: { + type: Boolean, + default: false, + }, + // 琛ㄦ牸琛岀粦瀹氱殑id鏁版嵁 + rowKey: { + type: String, + default: "", + }, + // chectype閫夐」绫� + checktype: { + type: String, + default: "check", + }, + }, + computed: { + elementHeight() { + return this.height; + }, + }, + data() { + return { + expandedData: [], + multipleSelection: [], + isCheckedAll: false, + }; + }, + watch: { + multipleSelection(val, oldval) { + + this.setIsCheckedAll(val); + this.$emit("checkData", val); + }, + + tableLoading() { + this.multipleSelection = []; + }, + + elementHeight(){ + + this.multipleSelection = []; + } + }, + mounted() {}, + methods: { + formatType(val, format) { + if (typeof format === "function") { + return format(val); + } else return ""; + }, + dataTypeFn(val, format) { + if (typeof format === "function") { + return format(val); + } else return val; + }, + toggleSelection(row, type) { + this.$refs.multipleTable.toggleRowSelection(row, type); + }, + clearSection(row) { + this.$refs.multipleTable.clearSelection(); + }, + // 閫夋嫨鐨勬柟娉� + // selectchange(selection, row) { + + + // if (this.checktype == "radio") { + // row.isChecked = true; + // if (this.multipleSelection.length < 0) { + // this.multipleSelection.push(row); + // } else { + // this.toggleSelection(this.multipleSelection[0],false) + + // this.multipleSelection.splice(0, 1, row); + // } + // } else { + + // if (!row.isChecked) { + // this.multipleSelection.push(row); + // row.isChecked = true; + // if ( + // row.children && + // this.expandedData.indexOf(row[this.rowKey]) > -1 + // ) { + // row.children.map((item) => { + // this.toggleSelection(item, true); + // item.isChecked = true; + // this.multipleSelection.push(item); + // }); + // } + // } else { + + // row.isChecked = false; + // this.multipleSelection.splice(this.multipleSelection.indexOf(row), 1); + // if (row.children) { + // row.children.map((item) => { + + // this.toggleSelection(item, false); + // item.isChecked = false; + // this.multipleSelection.splice( + // this.multipleSelection.indexOf(item), + // 1 + // ); + // }); + // } + // } + // } + // }, + selectchange(selection, row) { + + if (this.checktype === "radio") { + row.isChecked = true; + if (this.multipleSelection.length < 0) { + this.multipleSelection.push(row); + } else { + this.toggleSelection(this.multipleSelection[0], false); + this.multipleSelection.splice(0, 1, row); + } + } else { + if (!row.isChecked) { + console.log('閫夋嫨鎿嶄綔'); + this.multipleSelection.push(row); + row.isChecked = true; + if (row.children && this.expandedData.includes(row[this.rowKey])) { + row.children.forEach((item) => { + this.toggleSelection(item, true); + item.isChecked = true; + this.multipleSelection.push(item); + }); + } + } else { + console.log('鍙栨秷閫夋嫨鎿嶄綔'); + row.isChecked = false; + this.removeSelectionAndChildren(row); + } + } + }, + + removeSelectionAndChildren(row) { + this.toggleSelection(row, false); + this.multipleSelection = this.multipleSelection.filter(item => item !== row); + if (row.children) { + row.children.forEach((child) => { + this.toggleSelection(child, false); + child.isChecked = false; + this.removeSelectionAndChildren(child); // 閫掑綊绉婚櫎 + }); + } + }, + // 鏁版嵁琛岀偣鍑诲睍寮�鐨勬柟娉� + expandChange(record, expanded) { + if (expanded) { + this.expandedData.push(record[this.rowKey]); + } else { + this.expandedData = this.expandedData.filter( + (key) => key !== record[this.rowKey] + ); + } + }, + //鏍戠姸琛ㄦ牸鍏ㄩ�� + selectAll(selection) { + + if (this.checktype == "check") { + this.isCheckedAll = !this.isCheckedAll; + if (this.isCheckedAll) { + this.$refs.multipleTable.data.map((items) => { + if (!items.isChecked) { + items.isChecked = true; + this.toggleSelection(items, true); + this.multipleSelection.push(items); + + if ( + this.expandedData.indexOf(items[this.rowKey]) > -1 && + items.children + ) { + items.children.map((item) => { + this.toggleSelection(item, true); + item.isChecked = true; + this.multipleSelection.push(item); + }); + } + } + }); + } else { + this.$refs.multipleTable.data.map((items) => { + this.toggleSelection(items, false); + items.isChecked = false; + if (items.children) { + items.children.map((item) => { + this.toggleSelection(item, false); + item.isChecked = false; + }); + } + }); + this.multipleSelection = []; + } + }else{ + this.clearSection() + } + }, + setIsCheckedAll(data) { + let num = 0; + + let arrlist = this.$refs.multipleTable.data.map((item) => { + return item[this.rowKey]; + }); + if (data.length) { + data.forEach((item) => { + if (item.isChecked && arrlist.indexOf(item[this.rowKey]) > -1) { + num += 1; + } + }); + if (num == this.$refs.multipleTable.data.length) { + this.isCheckedAll = true; + } else { + this.isCheckedAll = false; + } + } else { + this.isCheckedAll = false; + } + }, + clickFun(info, type) { + switch (type) { + case 4: + this.$emit("checkLook", info); + break; + } + }, + }, +}; +</script> + +<style scoped> +.overClass { + /* white-space: pre-wrap; */ + width: 100% !important; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} +/* .el-table .warning-row { + background: oldlace; + } + .el-table .success-row { + background: #f0f9eb; + } */ + +/* .app-container /deep/ .el-table, .el-table__expanded-cell { + background-color: transparent; +} +.app-container /deep/ .el-table tr { + background-color: transparent!important; +} +.app-container /deep/ .el-table--enable-row-transition .el-table__body td, .el-table .cell{ + background-color: transparent; +} */ +</style> diff --git a/src/components/Table/mixins/resize.js b/src/components/Table/mixins/resize.js new file mode 100644 index 0000000..f0106ce --- /dev/null +++ b/src/components/Table/mixins/resize.js @@ -0,0 +1,29 @@ +export default { + data() { + return { + elementHeight: null, + contHeight: null + } + }, + created() { + this.getElHeight(0); + }, + mounted() { + window.addEventListener('resize', this.getElHeight) + }, + beforeDestroy() { + window.removeEventListener('resize', this.getElHeight); // 绉婚櫎绐楀彛澶у皬鍙樺寲鐩戝惉鍣� + }, + methods: { + // 璁剧疆琛ㄦ牸楂樺害 + getElHeight(num) { + this.$nextTick(() => { + this.elementHeight = + this.$refs.contBox.$el.clientHeight - + this.$refs.headBox.offsetHeight - + 124 - + this.$refs.pagination.offsetHeight + num; + }); + }, + } +} diff --git a/src/variableSet/checkTaskItem.js b/src/variableSet/checkTaskItem.js new file mode 100644 index 0000000..73d8cc8 --- /dev/null +++ b/src/variableSet/checkTaskItem.js @@ -0,0 +1,22 @@ +// 缁撴灉鍊� +export const testVal = '100' +// 鏁版嵁JSON +export const testValJson = '150' +// 杩囩▼缁撴灉1 +export const testVal1 = '110' +// 鎶�鏈姹� +// export const testVal2 = '180' +// 杩囩▼缁撴灉2 +export const testVal2 = '110' +// 杩囩▼缁撴灉3 +export const testVal3 = '110' +// 杩囩▼缁撴灉4 +export const testVal4 = '110' +// 杩囩▼缁撴灉5 +export const testVal5 = '110' +// 鎻忚堪 +export const description = '160' +// 鏈�鍚庢洿鏂颁汉濮撳悕 +export const lastUpdatedUserName = '120' +// 鏈�鍚庢洿鏂版棩鏈熸椂闂� +export const lastUpdatedDateTime = '160' \ No newline at end of file diff --git a/src/variableSet/columns.js b/src/variableSet/columns.js new file mode 100644 index 0000000..f1b3d75 --- /dev/null +++ b/src/variableSet/columns.js @@ -0,0 +1,83 @@ +// 妫�楠岄」鐩紪鍙� +export const checkItemNo = '150' +// 妫�楠岄」鐩悕绉� +export const checkItemName = '150' +// 缁熻绫诲瀷 +export const checkType = '80' +// 鎶�鏈姹� +export const checkStandard = '180' +// 鍙傝�冩爣鍑嗗�� +export const standardVal = '150' +// 鍙傝�冧笂闄愬�� +export const standardHigh = '100' +// 鍙傝�冧笅闄愬�� +export const standardLow = '100' +// 妫�楠屽伐鍏� +export const checkTool = '180' +// 鏄惁鑷姩鍒ゆ柇 +export const isAutoCheck = '120' +// 鏄惁蹇呭~ +export const isToSpc = '80' +// 鍗曚綅 +export const unit = '100' +// 鏄惁鍚敤 +export const status = '80' +// 澶囨敞 +export const description = '160' +// 鏈�鍚庢洿鏂颁汉濮撳悕 +export const lastUpdatedUserName = '120' +// 鏈�鍚庢洿鏂版棩鏈熸椂闂� +export const lastUpdatedDateTime = '160' + +// 缂栧彿 +export const noWidth = '150' +// 鍚嶇О +export const nameWidth = '150' +// 绫诲瀷 +export const classWidth = '80' +// 瑕佹眰 +export const requireWidth = '180' +// 澶囨敞 +export const descrWidth = '160' +// 宸ュ叿 +export const toolWidth = '180' +// 鏄惁 +export const whetherWidth = '80' +// 鐘舵�� +export const statusWidth = '80' +// 涓氬姟 +export const businessWidth = '120' +// 瀹℃牳浜哄憳濮撳悕 +export const auditNameWidth = '100' +// 鏃堕棿 +export const timeWidth = '160' +// 宸ュ巶 +export const workWidth = '200' +// 渚涘簲鍟� +export const supplierWidth="180" +// istreeno +export const istreeno="200" + + +// 妫�娴嬩换鍔℃娴嬮」 +export const testItem="150" + +export const testWidth="500" +export const top="130" +export const checkResult="300" +export const action="100" + + + + + + + + + + + + + + + diff --git a/src/views/basicData/location/addModal.vue b/src/views/basicData/location/addModal.vue new file mode 100644 index 0000000..d706511 --- /dev/null +++ b/src/views/basicData/location/addModal.vue @@ -0,0 +1,283 @@ +<template> + <!-- 娣诲姞鎴栦慨鏀笽QC妫�楠岄」鐩璇濇 --> + <el-dialog + :title="title" + :visible.sync="open" + width="750px" + custom-class="madelClass" + :destroyOnClose="true" + > + <div class="contbox"> + <el-form + ref="form" + v-if="open" + :model="form" + :rules="rules" + :disabled="isCheck" + > + <el-form-item + v-for="(item, index) in formItem" + :key="index" + :label="item.label" + :prop="item.prop" + label-width="120px" + :class="item.component == 'inputNumber' ? 'itemFixed' : ''" + > + <template v-if="item.component == 'input'"> + <el-input + v-model="form[item.prop]" + :readonly="item.readonly" + :placeholder=" + item.prop == 'checkItemNo' ? '鑷姩鐢熸垚' : '璇疯緭鍏�' + item.label + " + /> + </template> + <template v-if="item.component == 'inputNumber'"> + <el-input-number + v-model="form[item.prop]" + :label="'璇疯緭鍏�' + item.label" + ></el-input-number> + </template> + <template v-if="item.component == 'textarea'"> + <el-input + type="textarea" + :rows="2" + :placeholder="'璇疯緭鍏�' + item.label" + v-model="form[item.prop]" + > + </el-input> + </template> + <template v-if="item.component == 'select'"> + <template v-if="item.prop == 'checkType'"> + <el-select + v-model="form[item.prop]" + :placeholder="'璇烽�夋嫨' + item.label" + v-if="item.prop == 'checkType'" + style="width: 100%" + > + <el-option + v-for="dict in dict.type.check_type" + :key="dict.value" + :label="dict.label" + :value="dict.value" + > + </el-option> + </el-select> + </template> + + <template v-if="item.prop == 'locationGroupNo'"> + <el-select + v-model="form[item.prop]" + :placeholder="'璇烽�夋嫨' + item.label" + v-if="item.prop == 'locationGroupNo'" + style="width: 100%" + > + <el-option + v-for="dict in dict.type.check_type" + :key="dict.value" + :label="dict.label" + :value="dict.value" + > + </el-option> + </el-select> + </template> + + <template v-if="item.prop == 'isAutoCheck'"> + <el-select + v-model="form[item.prop]" + :placeholder="'璇烽�夋嫨' + item.label" + + style="width: 100%" + > + <el-option + v-for="dict in dict.type.is_auto_check" + :key="dict.value" + :label="dict.label" + :value="dict.value" + > + </el-option> + </el-select> + </template> + <template v-if="item.prop == 'isRequired'"> + <el-select + v-model="form[item.prop]" + :placeholder="'璇烽�夋嫨' + item.label" + style="width: 100%" + > + <el-option + v-for="dict in dict.type.is_required" + :key="dict.value" + :label="dict.label" + :value="dict.value" + > + </el-option> + </el-select> + </template> + <template v-if="item.prop == 'isToSpc'"> + <el-select + v-model="form[item.prop]" + :placeholder="'璇烽�夋嫨' + item.label" + style="width: 100%" + > + <el-option + v-for="dict in dict.type.is_to_spc" + :key="dict.value" + :label="dict.label" + :value="dict.value" + > + </el-option> + </el-select> + </template> + <template v-if="item.prop == 'status'"> + <el-select + v-model="form[item.prop]" + :placeholder="'璇烽�夋嫨' + item.label" + style="width: 100%" + > + <el-option + v-for="dict in dict.type.status" + :key="dict.value" + :label="dict.label" + :value="dict.value" + > + </el-option> + </el-select> + </template> + </template> + </el-form-item> + </el-form> + </div> + + <div slot="footer" class="dialog-footer"> + <el-button + v-if="!isCheck" + :loading="buttonLoading" + type="primary" + @click="submitForm" + >纭� 瀹�</el-button + > + <el-button @click="cancel">鍙� 娑�</el-button> + </div> + </el-dialog> +</template> + +<script> +import { formatData, formrRquired, formatDataItem } from "./info.data"; +import { getLocation, addLocation, updateLocation } from "@/api/basicData/location"; + +export default { + name: "checkItemAdd", + components: {}, + dicts: ["check_type", "is_auto_check", "is_required", "is_to_spc", "status"], + data() { + return { + form: JSON.parse(JSON.stringify(formatData)), + rules: formrRquired, + open: false, + title: "", + buttonLoading: false, + isCheck: false, + }; + }, + + computed: { + formItem() { + return formatDataItem; + }, + }, + watch:{ + open(val){ + if(!val){ + this.$refs["form"].resetFields(); + + } + + } + }, + mounted() {}, + methods: { + /** 鎻愪氦鎸夐挳 */ + submitForm() { + this.$refs["form"].validate((valid) => { + if (valid) { + this.buttonLoading = true; + if (this.form.checkItemId != null) { + updateLocation(this.form) + .then((response) => { + this.$modal.msgSuccess("淇敼鎴愬姛"); + this.open = false; + this.$emit("getList"); + }) + .finally(() => { + this.buttonLoading = false; + }); + } else { + addLocation(this.form) + .then((response) => { + this.$modal.msgSuccess("鏂板鎴愬姛"); + this.open = false; + this.$emit("getList"); + }) + .finally(() => { + this.buttonLoading = false; + }); + } + } + }); + }, + // 鍙栨秷鎸夐挳 + cancel() { + this.reset(); + }, + reset() { + this.$refs["form"].resetFields(); + this.open = false; + this.isCheck = false; + }, + elDialogShow(type, info = "") { + this.open = true; + if (type == 1) { + this.title = "妫�娴嬮」鐩坊鍔�"; + this.isCheck = false; + } else if (type == 2) { + this.isCheck = false; + this.getDetailse(info); + this.title = "妫�娴嬮」鐩紪杈�"; + } else { + this.title = "妫�娴嬮」鐩煡鐪�"; + this.isCheck = true; + this.getDetailse(info); + } + this.$nextTick(()=>{ + + }) + }, + getDetailse(id) { + getLocation(id).then((res) => { + if (res.code === 200) { + this.form = res.data; + } + }); + }, + }, +}; +</script> + +<style lang="less" scoped> +.contbox { + max-height: 60vh !important; + overflow: auto; + box-sizing: border-box; + padding: 0 20px; +} +.itemFixed { + display: inline-block !important; +} +.itemFixed:first-child { + display: block !important; +} +::v-deep .is-disabled .el-input__inner { + color: #606266 !important; +} +// ::v-deep .el-input.is-disabled .el-input__inner +</style> diff --git a/src/views/basicData/location/index.vue b/src/views/basicData/location/index.vue index b3759a5..fa079dd 100644 --- a/src/views/basicData/location/index.vue +++ b/src/views/basicData/location/index.vue @@ -1,40 +1,783 @@ <template> <div class="box"> <el-card class="box-card1"> - <div v-for="o in 4" :key="o" class="text item"> - {{'鍒楄〃鍐呭 ' + o }} - </div> -</el-card> -<el-card class="box-card2"> - <div v-for="o in 4" :key="o" class="text item"> - {{'鍒楄〃鍐呭 ' + o }} - </div> -</el-card> + <div> + <el-menu + class="sidebar-el-menu" + background-color="white" + text-color="#7a8297" + active-text-color="#2d8cf0" + > + <div v-for="(item, index) in leftListdata" :key="item.werksId"> + <!-- 涓�绾ц彍鍗� --> + <el-menu-item + :index="index.toString()" + :class="{ 'is-active': currentIndex === index.toString() }" + v-if="item.detailList == null" + @click="handleClick(item, index.toString())" + > + <span slot="title">{{ item.werksName }}</span> + </el-menu-item> + <!-- 浜岀骇鑿滃崟 --> + <el-submenu + :index="index.toString()" + v-else + > + <template #title> + <span>{{ item.werksName }}</span> + </template> + <el-menu-item-group :class="{ 'is-active': currentIndex === index.toString() }"> + <el-menu-item + v-for="(it, subIndex) in item.detailList" + :key="it.warehouseId" + :index="`${index}-${subIndex}`" + :class="{ 'is-active': currentIndex === `${index}-${subIndex}` }" + @click="handleClick(it, `${index}-${subIndex}`)" + > + {{ it.warehouseName }} + </el-menu-item> + </el-menu-item-group> + </el-submenu> + </div> + </el-menu> + </div> + </el-card> + <!-- 鍙充晶 --> + <el-card class="box-card2"> + <div class="box1"> + <el-form + :model="queryParams" + ref="queryForm" + size="small" + :inline="true" + v-show="showSearch" + label-width="68px" + > + <el-form-item label="浠撳簱" prop="lgort"> + <el-input + v-model="queryParams.lgort" + placeholder="璇疯緭鍏ヤ粨搴�" + clearable + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鍚嶇О" prop="locationName"> + <el-input + v-model="queryParams.locationName" + placeholder="璇疯緭鍏ュ悕绉�" + clearable + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鐘舵��" prop="state"> + <el-input + v-model="queryParams.state" + placeholder="璇疯緭鍏ョ姸鎬�" + clearable + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item> + <el-button + type="primary" + icon="el-icon-search" + size="mini" + @click="handleQuery" + >鎼滅储</el-button + > + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery" + >閲嶇疆</el-button + > + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="handleAdd" + v-hasPermi="['system:location:add']" + >鏂板</el-button + > + </el-col> + <el-col :span="1.5"> + <el-button + type="success" + plain + icon="el-icon-edit" + size="mini" + :disabled="single" + @click="handleUpdate" + v-hasPermi="['system:location:edit']" + >淇敼</el-button + > + </el-col> + <el-col :span="1.5"> + <el-button + type="danger" + plain + icon="el-icon-delete" + size="mini" + :disabled="multiple" + @click="handleDelete" + v-hasPermi="['system:location:remove']" + >鍒犻櫎</el-button + > + </el-col> + <el-col :span="1.5"> + <el-button + type="warning" + plain + icon="el-icon-download" + size="mini" + @click="handleExport" + v-hasPermi="['system:location:export']" + >瀵煎嚭</el-button + > + </el-col> + <right-toolbar + :showSearch.sync="showSearch" + @queryTable="getList" + ></right-toolbar> + </el-row> + + <el-table + v-loading="loading" + border + :data="locationList" + @selection-change="handleSelectionChange" + > + <el-table-column type="selection" width="55" align="center" /> + <el-table-column label="搴忓彿" type="index" fixed width="50" /> + <!-- <el-table-column label="搴撲綅ID" align="center" prop="locationId" v-if="true"/> --> + <el-table-column + label="闅跺睘搴撲綅ID" + align="center" + prop="parentLocationId" + /> + <el-table-column label="浠撳簱" align="center" prop="lgort" /> + <el-table-column label="搴撲綅搴忓彿" align="center" prop="locationNo" /> + <el-table-column label="鍚嶇О" align="center" prop="locationName" /> + <el-table-column label="宸ュ巶" align="center" prop="werks" /> + <el-table-column label="绫诲瀷" align="center" prop="type" /> + <el-table-column + label="浣撶Н闄愬埗" + align="center" + prop="volumeRestriction" + /> + <el-table-column label="閲嶉噺闄愬埗" align="center" prop="weightLimit" /> + <el-table-column + label="绠辨暟闄愬埗" + align="center" + prop="containerNumberLimit" + /> + <el-table-column + label="鏁伴噺闄愬埗" + align="center" + prop="quantitativeRestrictions" + /> + <el-table-column label="鎵樼洏闄愬埗" align="center" prop="trayLimit" /> + <el-table-column label="闀垮害" align="center" prop="length" /> + <el-table-column label="瀹�" align="center" prop="width" /> + <el-table-column label="楂�" align="center" prop="height" /> + <el-table-column label="鍧愭爣X" align="center" prop="coordinateX" /> + <el-table-column label="鍧愭爣Y" align="center" prop="coordinateY" /> + <el-table-column label="鍧愭爣Z" align="center" prop="coordinateZ" /> + <el-table-column label="鍍忕礌X" align="center" prop="pixelX" /> + <el-table-column label="鍍忕礌Y" align="center" prop="pixelY" /> + <el-table-column label="绌洪棿灞傛暟" align="center" prop="paceLayer" /> + <el-table-column + label="1-鍏佽" + align="center" + prop="allowMixedProduct" + /> + <el-table-column + label="1-鍏佽" + align="center" + prop="allowMixedProductLot" + /> + <el-table-column label="灞傜骇" align="center" prop="layer" /> + <el-table-column label="1-瀛樺湪" align="center" prop="hasChild" /> + <el-table-column label="璺緞" align="center" prop="path" /> + <el-table-column label="鎻忚堪" align="center" prop="description" /> + <!-- <el-table-column label="鐘舵��" align="center" prop="state" /> --> + <el-table-column + label="鏈�鍚庢洿鏂颁汉id" + align="center" + prop="lastUpdatedUserId" + /> + <el-table-column + label="鏈�鍚庢洿鏂颁汉濮撳悕" + align="center" + prop="lastUpdatedUserName" + /> + <el-table-column + label="鏈�鍚庢洿鏂版椂闂�" + align="center" + prop="lastUpdatedDateTime" + width="180" + > + <template slot-scope="scope"> + <span>{{ + parseTime(scope.row.lastUpdatedDateTime, "{y}-{m}-{d}") + }}</span> + </template> + </el-table-column> + <el-table-column + label="鎿嶄綔" + align="center" + class-name="small-padding fixed-width" + > + <template slot-scope="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="handleUpdate(scope.row)" + v-hasPermi="['system:location:edit']" + >淇敼</el-button + > + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row)" + v-hasPermi="['system:location:remove']" + >鍒犻櫎</el-button + > + </template> + </el-table-column> + </el-table> + + <pagination + v-show="total > 0" + :total="total" + :page.sync="queryParams.pageNum" + :limit.sync="queryParams.pageSize" + @pagination="getList" + /> + </div> + </el-card> + + <!-- 娣诲姞鎴栦慨鏀瑰簱浣嶅璇濇 --> + <el-dialog + :title="title" + v-if="open" + :visible.sync="open" + width="500px" + append-to-body + > + <el-form ref="form" :model="form" :rules="rules" label-width="80px"> + <!-- <el-form-item label="闅跺睘搴撲綅ID" prop="parentLocationId"> + <el-input v-model="form.parentLocationId" placeholder="璇疯緭鍏ラ毝灞炲簱浣岻D" /> + </el-form-item> --> + <el-form-item label="浠撳簱" prop="lgort"> + <el-input v-model="form.lgort" placeholder="璇疯緭鍏ヤ粨搴�" /> + </el-form-item> + <el-form-item label="搴撲綅搴忓彿" prop="locationNo"> + <el-input v-model="form.locationNo" placeholder="璇疯緭鍏ュ簱浣嶅簭鍙�" /> + </el-form-item> + <el-form-item label="鍚嶇О" prop="locationName"> + <el-input v-model="form.locationName" placeholder="璇疯緭鍏ュ悕绉�" /> + </el-form-item> + <el-form-item label="宸ュ巶" prop="werks"> + <!-- <el-input v-model="form.werks" placeholder="璇疯緭鍏ュ伐鍘�" /> --> + <el-select + v-model="form.werks" + placeholder="璇烽�夋嫨宸ュ巶" + style="width: 100%" + > + <el-option + v-for="dict in werksList" + :key="dict.werks" + :label="dict.werksName" + :value="dict.werks" + > + </el-option> + </el-select> + </el-form-item> + <el-form-item label="浣撶Н闄愬埗" prop="volumeRestriction"> + <el-input + v-model.number="form.volumeRestriction" + placeholder="璇疯緭鍏ヤ綋绉檺鍒�" + /> + </el-form-item> + <el-form-item label="閲嶉噺闄愬埗" prop="weightLimit"> + <el-input + v-model.number="form.weightLimit" + placeholder="璇疯緭鍏ラ噸閲忛檺鍒�" + /> + </el-form-item> + <el-form-item label="绠辨暟闄愬埗" prop="containerNumberLimit"> + <el-input + v-model.number="form.containerNumberLimit" + placeholder="璇疯緭鍏ョ鏁伴檺鍒�" + /> + </el-form-item> + <el-form-item label="鏁伴噺闄愬埗" prop="quantitativeRestrictions"> + <el-input + v-model.number="form.quantitativeRestrictions" + placeholder="璇疯緭鍏ユ暟閲忛檺鍒�" + /> + </el-form-item> + <el-form-item label="鎵樼洏闄愬埗" prop="trayLimit"> + <el-input v-model="form.trayLimit" placeholder="璇疯緭鍏ユ墭鐩橀檺鍒�" /> + </el-form-item> + <el-form-item label="闀垮害" prop="length"> + <el-input v-model.number="form.length" placeholder="璇疯緭鍏ラ暱搴�" /> + </el-form-item> + <el-form-item label="瀹�" prop="width"> + <el-input v-model.number="form.width" placeholder="璇疯緭鍏ュ" /> + </el-form-item> + <el-form-item label="楂�" prop="height"> + <el-input v-model.number="form.height" placeholder="璇疯緭鍏ラ珮" /> + </el-form-item> + <el-form-item label="鍧愭爣X" prop="coordinateX"> + <el-input v-model="form.coordinateX" placeholder="璇疯緭鍏ュ潗鏍嘪" /> + </el-form-item> + <el-form-item label="鍧愭爣Y" prop="coordinateY"> + <el-input v-model="form.coordinateY" placeholder="璇疯緭鍏ュ潗鏍嘫" /> + </el-form-item> + <el-form-item label="鍧愭爣Z" prop="coordinateZ"> + <el-input v-model="form.coordinateZ" placeholder="璇疯緭鍏ュ潗鏍嘮" /> + </el-form-item> + <el-form-item label="鍍忕礌X" prop="pixelX"> + <el-input v-model="form.pixelX" placeholder="璇疯緭鍏ュ儚绱燲" /> + </el-form-item> + <el-form-item label="鍍忕礌Y" prop="pixelY"> + <el-input v-model="form.pixelY" placeholder="璇疯緭鍏ュ儚绱燳" /> + </el-form-item> + <el-form-item label="绌洪棿灞傛暟" prop="paceLayer"> + <el-input v-model="form.paceLayer" placeholder="璇疯緭鍏ョ┖闂村眰鏁�" /> + </el-form-item> + <el-form-item label="鏄惁鍏佽" prop="allowMixedProduct"> + <el-input + v-model="form.allowMixedProduct" + placeholder="璇疯緭鍏�1-鍏佽" + /> + </el-form-item> + <el-form-item label="鏄惁鍏佽" prop="allowMixedProductLot"> + <el-input + v-model="form.allowMixedProductLot" + placeholder="璇疯緭鍏�1-鍏佽" + /> + </el-form-item> + <el-form-item label="灞傜骇" prop="layer"> + <el-input v-model="form.layer" placeholder="璇疯緭鍏ュ眰绾�" /> + </el-form-item> + <el-form-item label="鏄惁瀛樺湪" prop="hasChild"> + <el-input v-model="form.hasChild" placeholder="璇疯緭鍏�1-瀛樺湪" /> + </el-form-item> + <el-form-item label="璺緞" prop="path"> + <el-input v-model="form.path" placeholder="璇疯緭鍏ヨ矾寰�" /> + </el-form-item> + <el-form-item label="鎻忚堪" prop="description"> + <el-input v-model="form.description" placeholder="璇疯緭鍏ユ弿杩�" /> + </el-form-item> + <!-- <el-form-item label="鐘舵��" prop="state"> + <el-input v-model="form.state" placeholder="璇疯緭鍏ョ姸鎬�" /> + </el-form-item> --> + <!-- <el-form-item label="鏈�鍚庢洿鏂颁汉id" prop="lastUpdatedUserId"> + <el-input v-model="form.lastUpdatedUserId" placeholder="璇疯緭鍏ユ渶鍚庢洿鏂颁汉id" /> + </el-form-item> + <el-form-item label="鏈�鍚庢洿鏂颁汉濮撳悕" prop="lastUpdatedUserName"> + <el-input v-model="form.lastUpdatedUserName" placeholder="璇疯緭鍏ユ渶鍚庢洿鏂颁汉濮撳悕" /> + </el-form-item> + <el-form-item label="鏈�鍚庢洿鏂版椂闂�" prop="lastUpdatedDateTime"> + <el-date-picker clearable + v-model="form.lastUpdatedDateTime" + type="datetime" + value-format="yyyy-MM-dd HH:mm:ss" + placeholder="璇烽�夋嫨鏈�鍚庢洿鏂版椂闂�"> + </el-date-picker> + </el-form-item> --> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button :loading="buttonLoading" type="primary" @click="submitForm" + >纭� 瀹�</el-button + > + <el-button @click="cancel">鍙� 娑�</el-button> + </div> + </el-dialog> </div> </template> <script> -export default { +import { + listLocation, + getLocation, + delLocation, + addLocation, + updateLocation, + listWaresList, + listwerkshouse, +} from "@/api/basicData/location"; -} +export default { + name: "Location", + data() { + return { + // 鎸夐挳loading + buttonLoading: false, + // 閬僵灞� + loading: true, + // 閫変腑鏁扮粍 + ids: [], + // 闈炲崟涓鐢� + single: true, + // 闈炲涓鐢� + multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, + // 鎬绘潯鏁� + total: 0, + // 搴撲綅琛ㄦ牸鏁版嵁 + locationList: [], + // 寮瑰嚭灞傛爣棰� + title: "", + // 鏄惁鏄剧ず寮瑰嚭灞� + open: false, + // 鏌ヨ鍙傛暟 + queryParams: { + pageNum: 1, + pageSize: 10, + lgort: undefined, + locationName: undefined, + warehouseName:undefined, + werks:undefined, + lgort:undefined, + type: undefined, + state: undefined, + }, + // 琛ㄥ崟鍙傛暟 + form: {}, + werksList: [], + leftListdata: [], + currentIndex: null, + defaultProps: { + children: "detailList", + label: "werksName", + }, + // 琛ㄥ崟鏍¢獙 + rules: { + // locationId: [ + // { required: true, message: "搴撲綅ID涓嶈兘涓虹┖", trigger: "blur" } + // ], + parentLocationId: [ + { required: true, message: "闅跺睘搴撲綅ID涓嶈兘涓虹┖", trigger: "blur" }, + ], + lgort: [{ required: true, message: "浠撳簱涓嶈兘涓虹┖", trigger: "blur" }], + locationNo: [ + { required: true, message: "搴撲綅搴忓彿涓嶈兘涓虹┖", trigger: "blur" }, + ], + locationName: [ + { required: true, message: "鍚嶇О涓嶈兘涓虹┖", trigger: "blur" }, + ], + werks: [{ required: true, message: "宸ュ巶涓嶈兘涓虹┖", trigger: "blur" }], + type: [{ required: true, message: "绫诲瀷涓嶈兘涓虹┖", trigger: "change" }], + volumeRestriction: [ + { required: true, message: "浣撶Н闄愬埗涓嶈兘涓虹┖", trigger: "blur" }, + ], + weightLimit: [ + { required: true, message: "閲嶉噺闄愬埗涓嶈兘涓虹┖", trigger: "blur" }, + ], + containerNumberLimit: [ + { required: true, message: "绠辨暟闄愬埗涓嶈兘涓虹┖", trigger: "blur" }, + ], + quantitativeRestrictions: [ + { required: true, message: "鏁伴噺闄愬埗涓嶈兘涓虹┖", trigger: "blur" }, + ], + trayLimit: [ + { required: true, message: "鎵樼洏闄愬埗涓嶈兘涓虹┖", trigger: "blur" }, + ], + length: [{ required: true, message: "闀垮害涓嶈兘涓虹┖", trigger: "blur" }], + width: [{ required: true, message: "瀹戒笉鑳戒负绌�", trigger: "blur" }], + height: [{ required: true, message: "楂樹笉鑳戒负绌�", trigger: "blur" }], + coordinateX: [ + { required: true, message: "鍧愭爣X涓嶈兘涓虹┖", trigger: "blur" }, + ], + coordinateY: [ + { required: true, message: "鍧愭爣Y涓嶈兘涓虹┖", trigger: "blur" }, + ], + coordinateZ: [ + { required: true, message: "鍧愭爣Z涓嶈兘涓虹┖", trigger: "blur" }, + ], + pixelX: [{ required: true, message: "鍍忕礌X涓嶈兘涓虹┖", trigger: "blur" }], + pixelY: [{ required: true, message: "鍍忕礌Y涓嶈兘涓虹┖", trigger: "blur" }], + paceLayer: [ + { required: true, message: "绌洪棿灞傛暟涓嶈兘涓虹┖", trigger: "blur" }, + ], + allowMixedProduct: [ + { required: true, message: "1-鍏佽涓嶈兘涓虹┖", trigger: "blur" }, + ], + allowMixedProductLot: [ + { required: true, message: "1-鍏佽涓嶈兘涓虹┖", trigger: "blur" }, + ], + layer: [{ required: true, message: "灞傜骇涓嶈兘涓虹┖", trigger: "blur" }], + hasChild: [ + { required: true, message: "1-瀛樺湪涓嶈兘涓虹┖", trigger: "blur" }, + ], + path: [{ required: true, message: "璺緞涓嶈兘涓虹┖", trigger: "blur" }], + description: [ + { required: true, message: "鎻忚堪涓嶈兘涓虹┖", trigger: "blur" }, + ], + // state: [{ required: true, message: "鐘舵�佷笉鑳戒负绌�", trigger: "blur" }], + displayOrder: [ + { required: true, message: "鎺掑簭涓嶈兘涓虹┖", trigger: "blur" }, + ], + createdUserId: [ + { required: true, message: "鍒涘缓浜篿d涓嶈兘涓虹┖", trigger: "blur" }, + ], + createdUserName: [ + { required: true, message: "鍒涘缓浜哄鍚嶄笉鑳戒负绌�", trigger: "blur" }, + ], + createdDateTime: [ + { required: true, message: "鍒涘缓鏃ユ湡鏃堕棿涓嶈兘涓虹┖", trigger: "blur" }, + ], + lastUpdatedUserId: [ + { required: true, message: "鏈�鍚庢洿鏂颁汉id涓嶈兘涓虹┖", trigger: "blur" }, + ], + lastUpdatedUserName: [ + { + required: true, + message: "鏈�鍚庢洿鏂颁汉濮撳悕涓嶈兘涓虹┖", + trigger: "blur", + }, + ], + lastUpdatedDateTime: [ + { required: true, message: "鏈�鍚庢洿鏂版椂闂翠笉鑳戒负绌�", trigger: "blur" }, + ], + isDeleted: [ + { required: true, message: "鏄惁鍒犻櫎涓嶈兘涓虹┖", trigger: "blur" }, + ], + }, + }; + }, + created() { + this.getList(); + this.leftList(); + }, + methods: { + /** 鏌ヨ搴撲綅鍒楄〃 */ + getList() { + this.loading = true; + listLocation(this.queryParams).then((response) => { + this.locationList = response.rows; + this.total = response.total; + this.loading = false; + }); + }, + leftList() { + listWaresList().then((res) => { + console.log(res, "宸︿晶鏁版嵁淇℃伅"); + this.leftListdata = res.data; + }); + + listwerkshouse({ + pageNum: 1, + pageSize: 99, + }).then((res) => { + console.log(res, "宸ュ巶"); + this.werksList = res.rows; + }); + }, + // 鍙栨秷鎸夐挳 + cancel() { + this.open = false; + this.reset(); + }, + // 琛ㄥ崟閲嶇疆 + reset() { + this.form = { + locationId: undefined, + parentLocationId: undefined, + lgort: undefined, + locationNo: undefined, + locationName: undefined, + werks: undefined, + type: undefined, + volumeRestriction: undefined, + weightLimit: undefined, + containerNumberLimit: undefined, + quantitativeRestrictions: undefined, + trayLimit: undefined, + length: undefined, + width: undefined, + height: undefined, + coordinateX: undefined, + coordinateY: undefined, + coordinateZ: undefined, + pixelX: undefined, + pixelY: undefined, + paceLayer: undefined, + allowMixedProduct: undefined, + allowMixedProductLot: undefined, + layer: undefined, + hasChild: undefined, + path: undefined, + description: undefined, + state: undefined, + displayOrder: undefined, + createdUserId: undefined, + createdUserName: undefined, + createdDateTime: undefined, + lastUpdatedUserId: undefined, + lastUpdatedUserName: undefined, + lastUpdatedDateTime: undefined, + isDeleted: undefined, + }; + this.resetForm("form"); + }, + /** 鎼滅储鎸夐挳鎿嶄綔 */ + handleQuery() { + this.queryParams.pageNum = 1; + this.getList(); + }, + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + resetQuery() { + this.resetForm("queryForm"); + this.handleQuery(); + }, + // 澶氶�夋閫変腑鏁版嵁 + handleSelectionChange(selection) { + this.ids = selection.map((item) => item.locationId); + this.single = selection.length !== 1; + this.multiple = !selection.length; + }, + /** 鏂板鎸夐挳鎿嶄綔 */ + handleAdd() { + this.reset(); + this.open = true; + this.title = "娣诲姞搴撲綅"; + }, + /** 淇敼鎸夐挳鎿嶄綔 */ + handleUpdate(row) { + this.loading = true; + this.reset(); + const locationId = row.locationId || this.ids; + getLocation(locationId).then((response) => { + this.loading = false; + this.form = response.data; + this.open = true; + this.title = "淇敼搴撲綅"; + }); + }, + /** 鎻愪氦鎸夐挳 */ + submitForm() { + this.$refs["form"].validate((valid) => { + if (valid) { + this.buttonLoading = true; + if (this.form.locationId != null) { + updateLocation(this.form) + .then((response) => { + this.$modal.msgSuccess("淇敼鎴愬姛"); + this.open = false; + this.getList(); + }) + .finally(() => { + this.buttonLoading = false; + }); + } else { + addLocation(this.form) + .then((response) => { + this.$modal.msgSuccess("鏂板鎴愬姛"); + this.open = false; + this.getList(); + }) + .finally(() => { + this.buttonLoading = false; + }); + } + } + }); + }, + /** 鍒犻櫎鎸夐挳鎿嶄綔 */ + handleDelete(row) { + const locationIds = row.locationId || this.ids; + this.$modal + .confirm('鏄惁纭鍒犻櫎搴撲綅缂栧彿涓�"' + locationIds + '"鐨勬暟鎹」锛�') + .then(() => { + this.loading = true; + return delLocation(locationIds); + }) + .then(() => { + this.loading = false; + this.getList(); + this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + }) + .catch(() => {}) + .finally(() => { + this.loading = false; + }); + }, + /** 瀵煎嚭鎸夐挳鎿嶄綔 */ + handleExport() { + this.download( + "system/location/export", + { + ...this.queryParams, + }, + `location_${new Date().getTime()}.xlsx` + ); + }, + handleClick(item, index) { + this.currentIndex = index; + if (item.lgort) { + this.queryParams.lgort = item.lgort; + this.getList(); + }else{ + this.queryParams.werks = item.werks; + this.getList(); + } + console.log(item); // 澶勭悊鐐瑰嚮浜嬩欢锛屽彲浠ュ湪杩欓噷鑾峰彇鍒板綋鍓嶇偣鍑昏鐨勪俊鎭� + }, + }, +}; </script> + <style scoped> -.box{ +.box { width: 100%; height: calc(100vh - 124px); display: flex; - padding: 20px; + padding: 20px 10px 0; + background-color: #f0f0f0; } -.box-card1{ +.box-card1 { width: 20%; height: 100%; - background-color: #4b0f0f; + background-color: #fff; + margin-right: 10px; } -.box-card2{ +.box-card2 { width: 80%; height: 100%; - background-color: #58c8eb; + background-color: #fff; +} +.box1 { + width: 100%; + height: 100%; +} + +.is-active { + background-color: #2d8cf0 !important; /* 楂樹寒棰滆壊 */ +} + +::v-deep .el-menu-item { + border: none !important; /* 浣跨敤 !important 鏉ョ‘淇濊鐩栭粯璁ゆ牱寮� */ +} + +/* 濡傛灉杈规鏄敱 submenu 寮曡捣鐨勶紝鍙互杩欐牱鍐� */ +::v-deep .el-submenu .el-submenu__title { + border: none !important; +} + +::v-deep .box-card1 > .el-card__body{ + padding: 20px 0 10px 10px !important; } </style> diff --git a/src/views/basicData/location/info.data.js b/src/views/basicData/location/info.data.js new file mode 100644 index 0000000..bc52930 --- /dev/null +++ b/src/views/basicData/location/info.data.js @@ -0,0 +1,338 @@ +import * as vars from "@/variableSet/columns"; + + +export const columns = [ + { + label: '妫�楠岄」鐩紪鍙�', + align: 'left', + prop: 'checkItemNo', + width: vars.checkItemNo, + fixed: 'left', + tooltip: true, + }, + { + label: '妫�楠岄」鐩悕绉�', + align: 'left', + prop: 'checkItemName', + width: vars.checkItemName, + fixed: 'left', + }, + { + label: '缁熻绫诲瀷', + prop: 'checkType', + width: vars.checkType, + dataType: 'slot', + slot: 'checkType' + }, + { + label: '鎶�鏈姹�', + align: 'left', + prop: 'checkStandard', + width: vars.checkStandard, + }, + { + label: '鍙傝�冩爣鍑嗗��', + align: 'left', + prop: 'standardVal', + width: vars.standardVal, + }, + { + label: '鍙傝�冧笂闄愬��', + align: 'left', + prop: 'standardHigh', + width: vars.standardHigh, + }, + { + label: '鍙傝�冧笅闄愬��', + align: 'left', + prop: 'standardLow', + width: vars.standardLow, + }, + { + label: '妫�楠屽伐鍏�', + align: 'left', + prop: 'checkTool', + width: vars.checkTool, + }, + { + label: '鏄惁鑷姩鍒ゆ柇', + align: 'left', + prop: 'isAutoCheck', + width: vars.isAutoCheck, + dataType: 'slot', + slot: 'isAutoCheck' + + + }, + { + label: '鏄惁蹇呭~', + align: 'left', + prop: 'isRequired', + width: vars.isRequired, + dataType: 'slot', + slot: 'isRequired' + }, + { + label: '鏄惁SPC', + align: 'left', + prop: 'isToSpc', + width: vars.isToSpc, + dataType: 'slot', + slot: 'isToSpc' + }, + { + label: '鍗曚綅', + align: 'left', + prop: 'unit', + width: vars.unit, + }, + { + label: '鏄惁鍚敤', + prop: 'status', + width: vars.status, + dataType: 'slot', + slot: 'status' + }, + { + label: '澶囨敞', + align: 'left', + prop: 'description', + width: vars.description, + tooltip: true, + }, + { + label: '鏈�鍚庢洿鏂颁汉濮撳悕', + align: 'left', + prop: 'lastUpdatedUserName', + width: vars.lastUpdatedUserName, + }, + { + label: '鏈�鍚庢洿鏂版棩鏈熸椂闂�', + align: 'left', + prop: 'lastUpdatedDateTime', + width: vars.lastUpdatedDateTime, + }, + { + dataType: 'option', + label: '鎿嶄綔', + width: '80', + align: 'center', + fixed: 'right', + hasPermi: 'iqc_checkItem_check', + operation: [ + { + name: '鏌ョ湅', + size: 'mini', + plain: true, + typeText: 4 + } + ] + + } +]; +export const searchFormSchema = [ + { + field: 'checkItemNo', + label: '妫�楠岄」鐩紪鍙�:', + labelWidth: 80, + component: 'Input', + componentProps: { + placeholder: '璇疯緭鍏�', + }, + }, + { + field: 'checkItemName', + label: '妫�楠岄」鐩悕绉�:', + labelWidth: 80, + component: 'Input', + componentProps: { + placeholder: '璇疯緭鍏�', + }, + }, + { + field: 'checkType', + label: '缁熻绫诲瀷:', + labelWidth: 80, + component: 'Select', + componentProps: { + options: [ + { label: '瀹氭��', value: 1 }, + { label: '瀹氶噺', value: 3 }, + ], + }, + multiple: false, + }, + { + field: 'checkStandard', + label: '鎶�鏈姹�:', + labelWidth: 80, + component: 'Input', + componentProps: { + placeholder: '璇疯緭鍏�', + }, + }, +]; + +export const formatData = { + checkItemId: undefined, + checkItemNo: undefined, + checkItemName: undefined, + bizType: 10, + checkItemType: undefined, + materialId: undefined, + materialCatagoryId: undefined, + procedureId: undefined, + checkItemCategoryId: undefined, + checkItemControlId: undefined, + checkItemControlType: undefined, + checkItemControlParameter: undefined, + checkTool: undefined, + checkType: undefined, + checkStandard: undefined, + standardVal: undefined, + upperDeviation: undefined, + lowerDeviation: undefined, + standardHigh: undefined, + standardLow: undefined, + unit: undefined, + isRequired: undefined, + isSelfExternal: undefined, + isAutoCheck: undefined, + isToSpc: undefined, + isSupplierCheckItem: undefined, + description: undefined, + displayOrder: undefined, + status: undefined, + createdUserId: undefined, + createdUserName: undefined, + createdDateTime: undefined, + lastUpdatedUserId: undefined, + lastUpdatedUserName: undefined, + lastUpdatedDateTime: undefined, + isDeleted: undefined +}; + +export const formrRquired = { + checkItemName: [ + { required: true, message: "妫�楠岄」鐩悕绉颁笉鑳戒负绌�", trigger: "blur" } + ], + checkType: [ + { required: true, message: "缁熻绫诲瀷", trigger: "change" } + ], + unit: [ + { required: true, message: "璁¢噺鍗曚綅涓嶈兘涓虹┖", trigger: "blur" } + ], + upperDeviation: [{ + required: true, + message: "涓婂亸宸笉鑳戒负绌�", + trigger: "blur" + }], + lowerDeviation: [{ + required: true, + message: "涓嬪亸宸笉鑳戒负绌�", + trigger: "blur" + }], + unit: [ + { required: true, message: "璁¢噺鍗曚綅涓嶈兘涓虹┖", trigger: "blur" } + ], + standardHigh: [{ + required: true, + message: "鍙傝�冧笂闄愬�间笉鑳戒负绌�", + trigger: "blur" + }], + standardLow: [{ + required: true, + message: "鍙傝�冧笅闄愬�间笉鑳戒负绌�", + trigger: "blur" + }], +} +export const formatDataItem = [ + { + label: "妫�楠岄」鐩紪鍙�", + prop: 'checkItemNo', + component: 'input', + readonly: true + }, + { + label: "妫�楠岄」鐩悕绉�", + prop: 'checkItemName', + component: 'input' + + }, + { + label: "缁熻绫诲瀷", + prop: 'checkType', + component: 'select', + }, + + { + label: "搴撲綅缁�", + prop: 'locationGroupNo', + component: 'select', + }, + { + label: "鎶�鏈姹�", + prop: 'checkStandard', + component: 'input' + }, + { + label: "妫�楠屽伐鍏�", + prop: 'checkTool', + component: 'input' + }, + { + label: "鍙傝�冩爣鍑嗗��", + prop: 'standardVal', + component: 'inputNumber' + }, + { + label: "涓婂叕宸�", + prop: 'upperDeviation', + component: 'inputNumber' + }, + { + label: "涓嬪叕宸�", + prop: 'lowerDeviation', + component: 'inputNumber' + }, + { + label: "鍙傝�冧笂闄愬��", + prop: 'standardHigh', + component: 'inputNumber' + }, + { + label: "鍙傝�冧笅闄愬��", + prop: 'standardLow', + component: 'inputNumber' + }, + { + label: "鏄惁鑷姩鍒ゆ柇", + prop: 'isAutoCheck', + component: 'select' + }, + { + label: "鏄惁蹇呭~", + prop: 'isRequired', + component: 'select' + }, + { + label: "鏄惁SPC", + prop: 'isToSpc', + component: 'select' + }, + { + label: "鍗曚綅", + prop: 'unit', + component: 'input' + }, + { + label: "澶囨敞", + prop: 'description', + component: 'textarea' + }, + { + label: "鐘舵��", + prop: 'status', + component: 'select' + }, +] \ No newline at end of file diff --git a/src/views/basicData/locationGroup/addModal.vue b/src/views/basicData/locationGroup/addModal.vue new file mode 100644 index 0000000..e0a8f21 --- /dev/null +++ b/src/views/basicData/locationGroup/addModal.vue @@ -0,0 +1,294 @@ +<template> + <!-- 娣诲姞鎴栦慨鏀笽QC妫�楠岄」鐩璇濇 --> + <el-dialog + :title="title" + :visible.sync="open" + width="750px" + custom-class="madelClass" + :destroyOnClose="true" + > + <div class="contbox"> + <el-form + ref="form" + v-if="open" + :model="form" + :rules="rules" + :disabled="isCheck" + > + <el-form-item + v-for="(item, index) in formItem" + :key="index" + :label="item.label" + :prop="item.prop" + label-width="120px" + :class="item.component == 'inputNumber' ? 'itemFixed' : ''" + > + <template v-if="item.component == 'input'"> + <el-input + v-model="form[item.prop]" + :readonly="item.readonly" + :placeholder=" + item.prop == 'checkItemNo' ? '鑷姩鐢熸垚' : '璇疯緭鍏�' + item.label + " + /> + </template> + <template v-if="item.component == 'inputNumber'"> + <el-input-number + v-model="form[item.prop]" + :label="'璇疯緭鍏�' + item.label" + ></el-input-number> + </template> + <template v-if="item.component == 'textarea'"> + <el-input + type="textarea" + :rows="2" + :placeholder="'璇疯緭鍏�' + item.label" + v-model="form[item.prop]" + > + </el-input> + </template> + <template v-if="item.component == 'select'"> + <template v-if="item.prop == 'checkType'"> + <el-select + v-model="form[item.prop]" + :placeholder="'璇烽�夋嫨' + item.label" + v-if="item.prop == 'checkType'" + style="width: 100%" + > + <el-option + v-for="dict in dict.type.check_type" + :key="dict.value" + :label="dict.label" + :value="dict.value" + > + </el-option> + </el-select> + </template> + + <template v-if="item.prop == 'isAutoCheck'"> + <el-select + v-model="form[item.prop]" + :placeholder="'璇烽�夋嫨' + item.label" + + style="width: 100%" + > + <el-option + v-for="dict in dict.type.is_auto_check" + :key="dict.value" + :label="dict.label" + :value="dict.value" + > + </el-option> + </el-select> + </template> + <template v-if="item.prop == 'isRequired'"> + <el-select + v-model="form[item.prop]" + :placeholder="'璇烽�夋嫨' + item.label" + style="width: 100%" + > + <el-option + v-for="dict in dict.type.is_required" + :key="dict.value" + :label="dict.label" + :value="dict.value" + > + </el-option> + </el-select> + </template> + <template v-if="item.prop == 'isToSpc'"> + <el-select + v-model="form[item.prop]" + :placeholder="'璇烽�夋嫨' + item.label" + style="width: 100%" + > + <el-option + v-for="dict in dict.type.is_to_spc" + :key="dict.value" + :label="dict.label" + :value="dict.value" + > + </el-option> + </el-select> + </template> + + <template v-if="item.prop == 'werks'"> + <el-select + v-model="form[item.prop]" + :placeholder="'璇烽�夋嫨' + item.label" + v-if="item.prop == 'werks'" + style="width: 100%" + > + <el-option + v-for="dict in werksList" + :key="dict.werks" + :label="dict.werksName" + :value="dict.werks" + > + </el-option> + </el-select> + </template> + <template v-if="item.prop == 'status'"> + <el-select + v-model="form[item.prop]" + :placeholder="'璇烽�夋嫨' + item.label" + style="width: 100%" + > + <el-option + v-for="dict in dict.type.status" + :key="dict.value" + :label="dict.label" + :value="dict.value" + > + </el-option> + </el-select> + + </template> + </template> + </el-form-item> + </el-form> + </div> + + <div slot="footer" class="dialog-footer"> + <el-button + v-if="!isCheck" + :loading="buttonLoading" + type="primary" + @click="submitForm" + >纭� 瀹�</el-button + > + <el-button @click="cancel">鍙� 娑�</el-button> + </div> + </el-dialog> +</template> + +<script> +import { formatData, formrRquired, formatDataItem } from "./info.data"; +import { listwerkshouse } from "@/api/basicData/location"; +import { getLocationGroup, addLocationGroup, updateLocationGroup } from "@/api/basicData/locationGroup"; +export default { + name: "checkItemAdd", + components: {}, + dicts: ["check_type", "is_auto_check", "is_required", "is_to_spc", "status"], + data() { + return { + form: JSON.parse(JSON.stringify(formatData)), + rules: formrRquired, + open: false, + title: "", + buttonLoading: false, + isCheck: false, + werksList: [], + }; + }, + + computed: { + formItem() { + return formatDataItem; + }, + }, + watch:{ + open(val){ + if(!val){ + this.$refs["form"].resetFields(); + + } + + } + }, + mounted() { + + listwerkshouse({ + pageNum: 1, + pageSize: 99, + }).then(res =>{ + console.log(res, '宸ュ巶'); + this.werksList = res.rows; + }) + }, + methods: { + /** 鎻愪氦鎸夐挳 */ + submitForm() { + this.$refs["form"].validate((valid) => { + if (valid) { + this.buttonLoading = true; + if (this.form.locationGroupId != null) { + updateLocationGroup(this.form) + .then((response) => { + this.$modal.msgSuccess("淇敼鎴愬姛"); + this.open = false; + this.$emit("getList"); + }) + .finally(() => { + this.buttonLoading = false; + }); + } else { + addLocationGroup(this.form) + .then((response) => { + this.$modal.msgSuccess("鏂板鎴愬姛"); + this.open = false; + this.$emit("getList"); + }) + .finally(() => { + this.buttonLoading = false; + }); + } + } + }); + }, + // 鍙栨秷鎸夐挳 + cancel() { + this.reset(); + }, + reset() { + this.$refs["form"].resetFields(); + this.open = false; + this.isCheck = false; + }, + elDialogShow(type, info = "") { + this.open = true; + if (type == 1) { + this.title = "妫�娴嬮」鐩坊鍔�"; + this.isCheck = false; + } else if (type == 2) { + this.isCheck = false; + this.getDetailse(info); + this.title = "妫�娴嬮」鐩紪杈�"; + } else { + this.title = "妫�娴嬮」鐩煡鐪�"; + this.isCheck = true; + this.getDetailse(info); + } + this.$nextTick(()=>{ + + }) + }, + getDetailse(id) { + getLocationGroup(id).then((res) => { + if (res.code === 200) { + this.form = res.data; + } + }); + }, + }, +}; +</script> + +<style lang="less" scoped> +.contbox { + max-height: 60vh !important; + overflow: auto; + box-sizing: border-box; + padding: 0 20px; +} +.itemFixed { + display: inline-block !important; +} +.itemFixed:first-child { + display: block !important; +} +::v-deep .is-disabled .el-input__inner { + color: #606266 !important; +} +// ::v-deep .el-input.is-disabled .el-input__inner +</style> diff --git a/src/views/basicData/locationGroup/index.vue b/src/views/basicData/locationGroup/index.vue index d8ee741..c160371 100644 --- a/src/views/basicData/locationGroup/index.vue +++ b/src/views/basicData/locationGroup/index.vue @@ -1,410 +1,228 @@ <template> - <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> - <el-form-item label="搴撲綅缁勭紪鍙�" prop="locationGroupNo"> - <el-input - v-model="queryParams.locationGroupNo" - placeholder="璇疯緭鍏ュ簱浣嶇粍缂栧彿" - clearable - @keyup.enter.native="handleQuery" - /> - </el-form-item> - <el-form-item label="搴撲綅缁勫悕绉�" prop="locationGroupName"> - <el-input - v-model="queryParams.locationGroupName" - placeholder="璇疯緭鍏ュ簱浣嶇粍鍚嶇О" - clearable - @keyup.enter.native="handleQuery" - /> - </el-form-item> - <el-form-item label="浠撳簱缂栧彿" prop="lgort"> - <el-input - v-model="queryParams.lgort" - placeholder="璇疯緭鍏ヤ粨搴撶紪鍙�" - clearable - @keyup.enter.native="handleQuery" - /> - </el-form-item> - <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> - <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> - </el-form-item> - </el-form> - - <el-row :gutter="10" class="mb8"> - <el-col :span="1.5"> - <el-button - type="primary" - plain - icon="el-icon-plus" - size="mini" - @click="handleAdd" - v-hasPermi="['system:locationGroup:add']" - >鏂板</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="success" - plain - icon="el-icon-edit" - size="mini" - :disabled="single" - @click="handleUpdate" - v-hasPermi="['system:locationGroup:edit']" - >淇敼</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="danger" - plain - icon="el-icon-delete" - size="mini" - :disabled="multiple" - @click="handleDelete" - v-hasPermi="['system:locationGroup:remove']" - >鍒犻櫎</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="warning" - plain - icon="el-icon-download" - size="mini" - @click="handleExport" - v-hasPermi="['system:locationGroup:export']" - >瀵煎嚭</el-button> - </el-col> - <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> - </el-row> - - <el-table v-loading="loading" border :data="locationGroupList" @selection-change="handleSelectionChange"> - <el-table-column type="selection" width="55" align="center" /> - <el-table-column - label="搴忓彿" - type="index" - fixed - width="50" /> - <!-- <el-table-column label="搴撲綅缁処D" align="center" prop="locationGroupId" v-if="true"/> --> - <el-table-column label="搴撲綅缁勭紪鍙�" align="center" prop="locationGroupNo" /> - <el-table-column label="宸ュ巶" align="center" prop="werks" /> - <el-table-column label="搴撲綅缁勫悕绉�" align="center" prop="locationGroupName" /> - <el-table-column label="浠撳簱缂栧彿" align="center" prop="lgort" /> - <el-table-column label="鎻忚堪" align="center" prop="description" /> - <el-table-column label="鐘舵��" align="center" prop="state" /> - <el-table-column label="瀹℃牳鐘舵��" align="center" prop="auditState" /> - <el-table-column label="瀹℃牳浜篒D" align="center" prop="auditUserId" /> - <el-table-column label="瀹℃牳浜哄鍚�" align="center" prop="auditUserName" /> - <el-table-column label="瀹℃牳鏃ユ湡鏃堕棿" align="center" prop="auditDateTime" width="180"> - <template slot-scope="scope"> - <span>{{ parseTime(scope.row.auditDateTime, '{y}-{m}-{d}') }}</span> + <el-main class="contbox" ref="contBox"> + <div class="head" ref="headBox"> + <BaseSearch + @getList="getList" + :formItemList="searchFormSchema" + @search="getList" + @showSearchChange="getElHeight(28)" + > + <template #actionButton> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="handleAdd" + v-hasPermi="['iqc_checkItem_create']" + >鏂板</el-button + > + </el-col> + <el-col :span="1.5"> + <el-button + type="success" + plain + icon="el-icon-edit" + size="mini" + @click="handleUpdate" + v-hasPermi="['iqc_checkItem_edit']" + >淇敼</el-button + > + </el-col> + <el-col :span="1.5"> + <el-button + type="danger" + plain + icon="el-icon-delete" + size="mini" + @click="handleDelete" + v-hasPermi="['iqc_checkItem_delete']" + >鍒犻櫎</el-button + > + </el-col> </template> - </el-table-column> - <el-table-column label="瀹℃牳鎰忚" align="center" prop="auditOpinion" /> - <el-table-column label="鏈�鍚庢洿鏂颁汉id" align="center" prop="lastUpdatedUserId" /> - <el-table-column label="鏈�鍚庢洿鏂颁汉濮撳悕" align="center" prop="lastUpdatedUserName" /> - <el-table-column label="鏈�鍚庢洿鏂版椂闂�" align="center" prop="lastUpdatedDateTime" width="180"> - <template slot-scope="scope"> - <span>{{ parseTime(scope.row.lastUpdatedDateTime, '{y}-{m}-{d}') }}</span> - </template> - </el-table-column> - <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> - <template slot-scope="scope"> - <el-button - size="mini" - type="text" - icon="el-icon-edit" - @click="handleUpdate(scope.row)" - v-hasPermi="['system:locationGroup:edit']" - >淇敼</el-button> - <el-button - size="mini" - type="text" - icon="el-icon-delete" - @click="handleDelete(scope.row)" - v-hasPermi="['system:locationGroup:remove']" - >鍒犻櫎</el-button> - </template> - </el-table-column> - </el-table> - - <pagination - v-show="total>0" - :total="total" - :page.sync="queryParams.pageNum" - :limit.sync="queryParams.pageSize" - @pagination="getList" - /> - - <!-- 娣诲姞鎴栦慨鏀瑰簱浣嶇粍瀵硅瘽妗� --> - <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body> - <el-form ref="form" :model="form" :rules="rules" label-width="80px"> - <el-form-item label="搴撲綅缁勭紪鍙�" prop="locationGroupNo"> - <el-input v-model="form.locationGroupNo" placeholder="璇疯緭鍏ュ簱浣嶇粍缂栧彿" /> - </el-form-item> - <el-form-item label="宸ュ巶" prop="werks"> - <el-input v-model="form.werks" placeholder="璇疯緭鍏ュ伐鍘�" /> - </el-form-item> - <el-form-item label="搴撲綅缁勫悕绉�" prop="locationGroupName"> - <el-input v-model="form.locationGroupName" placeholder="璇疯緭鍏ュ簱浣嶇粍鍚嶇О" /> - </el-form-item> - <el-form-item label="浠撳簱缂栧彿" prop="lgort"> - <el-input v-model="form.lgort" placeholder="璇疯緭鍏ヤ粨搴撶紪鍙�" /> - </el-form-item> - <el-form-item label="鎻忚堪" prop="description"> - <el-input v-model="form.description" placeholder="璇疯緭鍏ユ弿杩�" /> - </el-form-item> - <el-form-item label="鐘舵��" prop="state"> - <el-input v-model="form.state" placeholder="璇疯緭鍏ョ姸鎬�" /> - </el-form-item> - <!-- <el-form-item label="鏈�鍚庢洿鏂颁汉id" prop="lastUpdatedUserId"> - <el-input v-model="form.lastUpdatedUserId" placeholder="璇疯緭鍏ユ渶鍚庢洿鏂颁汉id" /> - </el-form-item> - <el-form-item label="鏈�鍚庢洿鏂颁汉濮撳悕" prop="lastUpdatedUserName"> - <el-input v-model="form.lastUpdatedUserName" placeholder="璇疯緭鍏ユ渶鍚庢洿鏂颁汉濮撳悕" /> - </el-form-item> - <el-form-item label="鏈�鍚庢洿鏂版椂闂�" prop="lastUpdatedDateTime"> - <el-date-picker clearable - v-model="form.lastUpdatedDateTime" - type="datetime" - value-format="yyyy-MM-dd HH:mm:ss" - placeholder="璇烽�夋嫨鏈�鍚庢洿鏂版椂闂�"> - </el-date-picker> - </el-form-item> --> - </el-form> - <div slot="footer" class="dialog-footer"> - <el-button :loading="buttonLoading" type="primary" @click="submitForm">纭� 瀹�</el-button> - <el-button @click="cancel">鍙� 娑�</el-button> - </div> - </el-dialog> - </div> + </BaseSearch> + </div> + <TableCom + :column="tabiInfo.columns" + :table-data="tabiInfo.tableData" + :table-loading="tabiInfo.tableLoading" + :isSelection="tabiInfo.isSelection" + :height="elementHeight" + rowKey="locationGroupId" + ref="tabel" + @checkData="checkData" + @checkLook="checkInfo" + > + <template slot="checkType" slot-scope="scope"> + <dict-tag + :options="dict.type.check_type" + :value="scope.row.checkType" + /> + </template> + <template slot="isAutoCheck" slot-scope="scope"> + <dict-tag + :options="dict.type.is_auto_check" + :value="scope.row.isAutoCheck" + /> + </template> + <template slot="isRequired" slot-scope="scope"> + <dict-tag + :options="dict.type.is_required" + :value="scope.row.isRequired" + /> + </template> + <template slot="auditState" slot-scope="scope"> + <dict-tag :options="dict.type.audit_status" :value="scope.row.auditState" /> + </template> + <template slot="status" slot-scope="scope"> + <dict-tag :options="dict.type.status" :value="scope.row.status" /> + </template> + </TableCom> + <div class="pagination" ref="pagination"> + <pagination + v-show="pageInfo.pageTotal > 0" + :total="pageInfo.pageTotal" + :page.sync="pageInfo.currentPage" + :limit.sync="pageInfo.pageSize" + @pagination="getList" + /> + </div> + <AddaddModal ref="addaddModal" @getList="getList" /> + </el-main> </template> <script> -import { listLocationGroup, getLocationGroup, delLocationGroup, addLocationGroup, updateLocationGroup } from "@/api/basicData/locationGroup"; +import TableCom from "@/components/Table/index"; +import BaseSearch from "@/components/Table/BaseSearch"; + +import { columns, searchFormSchema } from "./info.data"; +import mixin from "@/components/Table/mixins/resize"; + +import { listLocationGroup, delLocationGroup } from "@/api/basicData/locationGroup"; +import AddaddModal from "./addModal"; export default { name: "LocationGroup", + components: { TableCom, BaseSearch, AddaddModal }, + mixins: [mixin], + dicts: ["audit_status", "status"], data() { return { - // 鎸夐挳loading - buttonLoading: false, - // 閬僵灞� - loading: true, - // 閫変腑鏁扮粍 - ids: [], - // 闈炲崟涓鐢� - single: true, - // 闈炲涓鐢� - multiple: true, - // 鏄剧ず鎼滅储鏉′欢 - showSearch: true, - // 鎬绘潯鏁� - total: 0, - // 搴撲綅缁勮〃鏍兼暟鎹� - locationGroupList: [], - // 寮瑰嚭灞傛爣棰� - title: "", - // 鏄惁鏄剧ず寮瑰嚭灞� - open: false, - // 鏌ヨ鍙傛暟 - queryParams: { - pageNum: 1, - pageSize: 10, - locationGroupNo: undefined, - locationGroupName: undefined, - lgort: undefined, + searchFormSchema: searchFormSchema, + tabiInfo: { + columns: columns, + tableData: [], + tableLoading: false, + isSelection: true, + rowClassName: "rowClassName", }, - // 琛ㄥ崟鍙傛暟 - form: {}, - // 琛ㄥ崟鏍¢獙 - rules: { - locationGroupId: [ - { required: true, message: "搴撲綅缁処D涓嶈兘涓虹┖", trigger: "blur" } - ], - locationGroupNo: [ - { required: true, message: "搴撲綅缁勭紪鍙蜂笉鑳戒负绌�", trigger: "blur" } - ], - werks: [ - { required: true, message: "宸ュ巶涓嶈兘涓虹┖", trigger: "blur" } - ], - locationGroupName: [ - { required: true, message: "搴撲綅缁勫悕绉颁笉鑳戒负绌�", trigger: "blur" } - ], - lgort: [ - { required: true, message: "浠撳簱缂栧彿涓嶈兘涓虹┖", trigger: "blur" } - ], - description: [ - { required: true, message: "鎻忚堪涓嶈兘涓虹┖", trigger: "blur" } - ], - state: [ - { required: true, message: "鐘舵�佷笉鑳戒负绌�", trigger: "blur" } - ], - displayOrder: [ - { required: true, message: "鎺掑簭涓嶈兘涓虹┖", trigger: "blur" } - ], - createdUserId: [ - { required: true, message: "鍒涘缓浜篿d涓嶈兘涓虹┖", trigger: "blur" } - ], - createdUserName: [ - { required: true, message: "鍒涘缓浜哄鍚嶄笉鑳戒负绌�", trigger: "blur" } - ], - createdDateTime: [ - { required: true, message: "鍒涘缓鏃ユ湡鏃堕棿涓嶈兘涓虹┖", trigger: "blur" } - ], - auditState: [ - { required: true, message: "瀹℃牳鐘舵�佷笉鑳戒负绌�", trigger: "blur" } - ], - auditUserId: [ - { required: true, message: "瀹℃牳浜篒D涓嶈兘涓虹┖", trigger: "blur" } - ], - auditUserName: [ - { required: true, message: "瀹℃牳浜哄鍚嶄笉鑳戒负绌�", trigger: "blur" } - ], - auditDateTime: [ - { required: true, message: "瀹℃牳鏃ユ湡鏃堕棿涓嶈兘涓虹┖", trigger: "blur" } - ], - auditOpinion: [ - { required: true, message: "瀹℃牳鎰忚涓嶈兘涓虹┖", trigger: "blur" } - ], - lastUpdatedUserId: [ - { required: true, message: "鏈�鍚庢洿鏂颁汉id涓嶈兘涓虹┖", trigger: "blur" } - ], - lastUpdatedUserName: [ - { required: true, message: "鏈�鍚庢洿鏂颁汉濮撳悕涓嶈兘涓虹┖", trigger: "blur" } - ], - lastUpdatedDateTime: [ - { required: true, message: "鏈�鍚庢洿鏂版椂闂翠笉鑳戒负绌�", trigger: "blur" } - ], - isDeleted: [ - { required: true, message: "鏄惁鍒犻櫎涓嶈兘涓虹┖", trigger: "blur" } - ] - } + pageInfo: { + pageSize: 10, + pageTotal: 0, + currentPage: 1, + }, + visible: false, + ids: [], + open: false, }; }, - created() { + mounted() { this.getList(); }, methods: { - /** 鏌ヨ搴撲綅缁勫垪琛� */ - getList() { - this.loading = true; - listLocationGroup(this.queryParams).then(response => { - this.locationGroupList = response.rows; - this.total = response.total; - this.loading = false; - }); - }, - // 鍙栨秷鎸夐挳 - cancel() { - this.open = false; - this.reset(); - }, - // 琛ㄥ崟閲嶇疆 - reset() { - this.form = { - locationGroupId: undefined, - locationGroupNo: undefined, - werks: undefined, - locationGroupName: undefined, - lgort: undefined, - description: undefined, - state: undefined, - displayOrder: undefined, - createdUserId: undefined, - createdUserName: undefined, - createdDateTime: undefined, - auditState: undefined, - auditUserId: undefined, - auditUserName: undefined, - auditDateTime: undefined, - auditOpinion: undefined, - lastUpdatedUserId: undefined, - lastUpdatedUserName: undefined, - lastUpdatedDateTime: undefined, - isDeleted: undefined + getList(info = {}) { + this.ids = []; + this.tabiInfo.tableLoading = true; + let params = { + pageSize: this.pageInfo.pageSize, + pageNum: this.pageInfo.currentPage, + bizType: 10, + ...info, }; - this.resetForm("form"); - }, - /** 鎼滅储鎸夐挳鎿嶄綔 */ - handleQuery() { - this.queryParams.pageNum = 1; - this.getList(); - }, - /** 閲嶇疆鎸夐挳鎿嶄綔 */ - resetQuery() { - this.resetForm("queryForm"); - this.handleQuery(); - }, - // 澶氶�夋閫変腑鏁版嵁 - handleSelectionChange(selection) { - this.ids = selection.map(item => item.locationGroupId) - this.single = selection.length!==1 - this.multiple = !selection.length - }, - /** 鏂板鎸夐挳鎿嶄綔 */ - handleAdd() { - this.reset(); - this.open = true; - this.title = "娣诲姞搴撲綅缁�"; - }, - /** 淇敼鎸夐挳鎿嶄綔 */ - handleUpdate(row) { - this.loading = true; - this.reset(); - const locationGroupId = row.locationGroupId || this.ids - getLocationGroup(locationGroupId).then(response => { - this.loading = false; - this.form = response.data; - this.open = true; - this.title = "淇敼搴撲綅缁�"; - }); - }, - /** 鎻愪氦鎸夐挳 */ - submitForm() { - this.$refs["form"].validate(valid => { - if (valid) { - this.buttonLoading = true; - if (this.form.locationGroupId != null) { - updateLocationGroup(this.form).then(response => { - this.$modal.msgSuccess("淇敼鎴愬姛"); - this.open = false; - this.getList(); - }).finally(() => { - this.buttonLoading = false; - }); - } else { - addLocationGroup(this.form).then(response => { - this.$modal.msgSuccess("鏂板鎴愬姛"); - this.open = false; - this.getList(); - }).finally(() => { - this.buttonLoading = false; - }); - } + listLocationGroup(params).then((res) => { + if (res.code == 200) { + this.pageInfo.pageTotal = res.total; + this.tabiInfo.tableData = res.rows; + this.tabiInfo.tableLoading = false; } }); }, - /** 鍒犻櫎鎸夐挳鎿嶄綔 */ - handleDelete(row) { - const locationGroupIds = row.locationGroupId || this.ids; - this.$modal.confirm('鏄惁纭鍒犻櫎搴撲綅缁勭紪鍙蜂负"' + locationGroupIds + '"鐨勬暟鎹」锛�').then(() => { - this.loading = true; - return delLocationGroup(locationGroupIds); - }).then(() => { - this.loading = false; - this.getList(); - this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => { - }).finally(() => { - this.loading = false; - }); + checkData(data) { + if (data.length) { + this.ids = data.map((item) => { + return item.locationGroupId; + }); + } else { + this.ids = []; + } }, - /** 瀵煎嚭鎸夐挳鎿嶄綔 */ - handleExport() { - this.download('system/locationGroup/export', { - ...this.queryParams - }, `locationGroup_${new Date().getTime()}.xlsx`) - } - } + handleAdd() { + this.$refs.addaddModal.elDialogShow(1); + }, + checkInfo(info) { + this.$refs.addaddModal.elDialogShow(3, info.locationGroupId); + }, + /** 淇敼鎸夐挳鎿嶄綔 */ + handleUpdate() { + if (this.ids.length > 1) { + this.$message({ + message: "鍙兘鎿嶄綔鍗曟潯鏁版嵁锛�", + type: "warning", + }); + return; + } else if (this.ids.length < 1) { + this.$message({ + message: "璇烽�夋嫨鏁版嵁", + type: "warning", + }); + return; + } + this.$refs.addaddModal.elDialogShow(2, this.ids[0]); + }, + handleDelete() { + const locationGroupIds = this.ids; + + if (locationGroupIds.length) { + this.$modal + .confirm( + '鏄惁纭鍒犻櫎宸查�変腑鐨勬暟鎹」锛�' + ) + .then(() => { + this.tabiInfo.tableLoading = true; + return delLocationGroup(locationGroupIds); + }) + .then(() => { + this.tabiInfo.tableLoading = false; + this.ids = []; + this.getList(); + this.$message({ + message: "鍒犻櫎鎴愬姛", + type: "success", + }); + }) + .catch(() => {}) + .finally(() => { + this.tabiInfo.tableLoading = false; + }); + } else { + this.$message({ + message: "璇烽�夋嫨鏁版嵁", + type: "warning", + }); + } + }, + }, }; </script> + +<style lang="less" scoped> +.rowClassName { + height: 50px; +} +.contbox { + width: 100; + height: 100%; +} +</style> diff --git a/src/views/basicData/locationGroup/info.data.js b/src/views/basicData/locationGroup/info.data.js new file mode 100644 index 0000000..3438c0d --- /dev/null +++ b/src/views/basicData/locationGroup/info.data.js @@ -0,0 +1,278 @@ +import * as vars from "@/variableSet/columns"; + + +export const columns = [ + { + label: '缂栧彿', + align: 'left', + prop: 'locationGroupNo', + width: vars.timeWidth, + fixed: 'left', + tooltip: true, + }, + { + label: '鍚嶇О', + align: 'left', + prop: 'locationGroupName', + width: vars.timeWidth, + fixed: 'left', + }, + { + label: '宸ュ巶', + align: 'left', + prop: 'werks', + fixed: 'left', + width: vars.timeWidth, + }, + { + label: '浠撳簱缂栧彿', + align: 'left', + prop: 'lgort', + width: vars.timeWidth, + + }, + + { + label: '鎻忚堪', + align: 'left', + prop: 'description', + width: vars.timeWidth, + tooltip: true, + }, + { + label: '瀹℃牳鐘舵��', + align: 'left', + prop: 'auditState', + dataType: 'slot', + slot: 'auditState', + width: vars.timeWidth, + }, + { + label: '瀹℃牳浜哄鍚�', + align: 'left', + prop: 'auditUserName', + width: vars.timeWidth, + }, + { + label: '瀹℃牳鏃ユ湡鏃堕棿', + align: 'left', + prop: 'auditDateTime', + width: vars.timeWidth, + }, + + { + label: '鏈�鍚庢洿鏂颁汉濮撳悕', + align: 'left', + prop: 'lastUpdatedUserName', + width: vars.lastUpdatedUserName, + }, + { + label: '鏈�鍚庢洿鏂版棩鏈熸椂闂�', + align: 'left', + prop: 'lastUpdatedDateTime', + width: vars.lastUpdatedDateTime, + }, + { + dataType: 'option', + label: '鎿嶄綔', + width: '80', + align: 'center', + fixed: 'right', + hasPermi: 'iqc_checkItem_check', + operation: [ + { + name: '鏌ョ湅', + size: 'mini', + plain: true, + typeText: 4 + } + ] + + } +]; +export const searchFormSchema = [ + + { + field: 'locationGroupName', + label: '鍚嶇О:', + labelWidth: 80, + component: 'Input', + componentProps: { + placeholder: '璇疯緭鍏�', + }, + }, + { + field: 'locationGroupNo', + label: '缂栧彿:', + labelWidth: 80, + component: 'Input', + componentProps: { + placeholder: '璇疯緭鍏�', + }, + }, + { + field: 'lgort', + label: '浠撳簱缂栧彿:', + labelWidth: 80, + component: 'Input', + componentProps: { + placeholder: '璇疯緭鍏�', + }, + }, + // { + // field: 'state', + // label: '鐘舵��:', + // labelWidth: 80, + // component: 'Select', + // componentProps: { + // options: [ + // { label: '鍚敤', value: '1' }, + // { label: '绂佺敤', value: '0' }, + // ], + // }, + // multiple: false, + // }, + +]; + +export const formatData = { + locationGroupId: undefined, + locationGroupNo: undefined, + werks: undefined, + locationGroupName: undefined, + lgort: undefined, + description: undefined, + state: undefined, + displayOrder: undefined, + createdUserId: undefined, + createdUserName: undefined, + createdDateTime: undefined, + auditState: undefined, + auditUserId: undefined, + auditUserName: undefined, + auditDateTime: undefined, + auditOpinion: undefined, + lastUpdatedUserId: undefined, + lastUpdatedUserName: undefined, + lastUpdatedDateTime: undefined, + isDeleted: undefined +}; + +export const formrRquired = { + locationGroupId: [ + { required: true, message: "搴撲綅缁処D涓嶈兘涓虹┖", trigger: "blur" } + ], + locationGroupNo: [ + { required: true, message: "搴撲綅缁勭紪鍙蜂笉鑳戒负绌�", trigger: "blur" } + ], + werks: [ + { required: true, message: "宸ュ巶涓嶈兘涓虹┖", trigger: "blur" } + ], + locationGroupName: [ + { required: true, message: "搴撲綅缁勫悕绉颁笉鑳戒负绌�", trigger: "blur" } + ], + lgort: [ + { required: true, message: "浠撳簱缂栧彿涓嶈兘涓虹┖", trigger: "blur" } + ], + description: [ + { required: true, message: "鎻忚堪涓嶈兘涓虹┖", trigger: "blur" } + ], + state: [ + { required: true, message: "鐘舵�佷笉鑳戒负绌�", trigger: "blur" } + ], + displayOrder: [ + { required: true, message: "鎺掑簭涓嶈兘涓虹┖", trigger: "blur" } + ], + createdUserId: [ + { required: true, message: "鍒涘缓浜篿d涓嶈兘涓虹┖", trigger: "blur" } + ], + createdUserName: [ + { required: true, message: "鍒涘缓浜哄鍚嶄笉鑳戒负绌�", trigger: "blur" } + ], + createdDateTime: [ + { required: true, message: "鍒涘缓鏃ユ湡鏃堕棿涓嶈兘涓虹┖", trigger: "blur" } + ], + auditState: [ + { required: true, message: "瀹℃牳鐘舵�佷笉鑳戒负绌�", trigger: "blur" } + ], + auditUserId: [ + { required: true, message: "瀹℃牳浜篒D涓嶈兘涓虹┖", trigger: "blur" } + ], + auditUserName: [ + { required: true, message: "瀹℃牳浜哄鍚嶄笉鑳戒负绌�", trigger: "blur" } + ], + auditDateTime: [ + { required: true, message: "瀹℃牳鏃ユ湡鏃堕棿涓嶈兘涓虹┖", trigger: "blur" } + ], + auditOpinion: [ + { required: true, message: "瀹℃牳鎰忚涓嶈兘涓虹┖", trigger: "blur" } + ], + lastUpdatedUserId: [ + { required: true, message: "鏈�鍚庢洿鏂颁汉id涓嶈兘涓虹┖", trigger: "blur" } + ], + lastUpdatedUserName: [ + { required: true, message: "鏈�鍚庢洿鏂颁汉濮撳悕涓嶈兘涓虹┖", trigger: "blur" } + ], + lastUpdatedDateTime: [ + { required: true, message: "鏈�鍚庢洿鏂版椂闂翠笉鑳戒负绌�", trigger: "blur" } + ], + isDeleted: [ + { required: true, message: "鏄惁鍒犻櫎涓嶈兘涓虹┖", trigger: "blur" } + ] +} +export const formatDataItem = [ + { + label: "缂栧彿", + prop: 'locationGroupNo', + component: 'input', + // readonly: true + }, + { + label: "鍚嶇О", + prop: 'locationGroupName', + component: 'input' + + }, + { + label: "宸ュ巶", + prop: 'werks', + component: 'select', + }, + { + label: "浠撳簱缂栧彿", + prop: 'lgort', + component: 'input' + }, + // { + // label: "鏄惁鍚敤", + // prop: 'isUseLocation', + // component: 'select' + // }, + // { + // label: "绠$悊鍛樺悕绉�", + // prop: 'userId', + // component: 'input' + // }, + // { + // label: "绠$悊鍛樼數璇�", + // prop: 'userPhone', + // component: 'input' + // }, + // { + // label: "鍧愭爣X", + // prop: 'lowerDeviation', + // component: 'inputNumber' + // }, + // { + // label: "鍧愭爣Y", + // prop: 'standardHigh', + // component: 'inputNumber' + // }, + + { + label: "鎻忚堪", + prop: 'description', + component: 'textarea' + }, + +] \ No newline at end of file diff --git a/src/views/basicData/locationGroup/linshi.vue b/src/views/basicData/locationGroup/linshi.vue new file mode 100644 index 0000000..1c42b1e --- /dev/null +++ b/src/views/basicData/locationGroup/linshi.vue @@ -0,0 +1,410 @@ +<template> + <div class="app-container"> + <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> + <el-form-item label="搴撲綅缁勭紪鍙�" prop="locationGroupNo"> + <el-input + v-model="queryParams.locationGroupNo" + placeholder="璇疯緭鍏ュ簱浣嶇粍缂栧彿" + clearable + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="搴撲綅缁勫悕绉�" prop="locationGroupName"> + <el-input + v-model="queryParams.locationGroupName" + placeholder="璇疯緭鍏ュ簱浣嶇粍鍚嶇О" + clearable + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="浠撳簱缂栧彿" prop="lgort"> + <el-input + v-model="queryParams.lgort" + placeholder="璇疯緭鍏ヤ粨搴撶紪鍙�" + clearable + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="handleAdd" + v-hasPermi="['system:locationGroup:add']" + >鏂板</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="success" + plain + icon="el-icon-edit" + size="mini" + :disabled="single" + @click="handleUpdate" + v-hasPermi="['system:locationGroup:edit']" + >淇敼</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="danger" + plain + icon="el-icon-delete" + size="mini" + :disabled="multiple" + @click="handleDelete" + v-hasPermi="['system:locationGroup:remove']" + >鍒犻櫎</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="warning" + plain + icon="el-icon-download" + size="mini" + @click="handleExport" + v-hasPermi="['system:locationGroup:export']" + >瀵煎嚭</el-button> + </el-col> + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> + </el-row> + + <el-table v-loading="loading" border :data="locationGroupList" @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55" align="center" /> + <el-table-column + label="搴忓彿" + type="index" + fixed + width="50" /> + <!-- <el-table-column label="搴撲綅缁処D" align="center" prop="locationGroupId" v-if="true"/> --> + <el-table-column label="搴撲綅缁勭紪鍙�" align="center" prop="locationGroupNo" /> + <el-table-column label="宸ュ巶" align="center" prop="werks" /> + <el-table-column label="搴撲綅缁勫悕绉�" align="center" prop="locationGroupName" /> + <el-table-column label="浠撳簱缂栧彿" align="center" prop="lgort" /> + <el-table-column label="鎻忚堪" align="center" prop="description" /> + <!-- <el-table-column label="鐘舵��" align="center" prop="state" /> --> + <el-table-column label="瀹℃牳鐘舵��" align="center" prop="auditState" /> + <el-table-column label="瀹℃牳浜篒D" align="center" prop="auditUserId" /> + <el-table-column label="瀹℃牳浜哄鍚�" align="center" prop="auditUserName" /> + <el-table-column label="瀹℃牳鏃ユ湡鏃堕棿" align="center" prop="auditDateTime" width="180"> + <template slot-scope="scope"> + <span>{{ parseTime(scope.row.auditDateTime, '{y}-{m}-{d}') }}</span> + </template> + </el-table-column> + <el-table-column label="瀹℃牳鎰忚" align="center" prop="auditOpinion" /> + <el-table-column label="鏈�鍚庢洿鏂颁汉id" align="center" prop="lastUpdatedUserId" /> + <el-table-column label="鏈�鍚庢洿鏂颁汉濮撳悕" align="center" prop="lastUpdatedUserName" /> + <el-table-column label="鏈�鍚庢洿鏂版椂闂�" align="center" prop="lastUpdatedDateTime" width="180"> + <template slot-scope="scope"> + <span>{{ parseTime(scope.row.lastUpdatedDateTime, '{y}-{m}-{d}') }}</span> + </template> + </el-table-column> + <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> + <template slot-scope="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="handleUpdate(scope.row)" + v-hasPermi="['system:locationGroup:edit']" + >淇敼</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row)" + v-hasPermi="['system:locationGroup:remove']" + >鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + + <pagination + v-show="total>0" + :total="total" + :page.sync="queryParams.pageNum" + :limit.sync="queryParams.pageSize" + @pagination="getList" + /> + + <!-- 娣诲姞鎴栦慨鏀瑰簱浣嶇粍瀵硅瘽妗� --> + <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body> + <el-form ref="form" :model="form" :rules="rules" label-width="80px"> + <el-form-item label="搴撲綅缁勭紪鍙�" prop="locationGroupNo"> + <el-input v-model="form.locationGroupNo" placeholder="璇疯緭鍏ュ簱浣嶇粍缂栧彿" /> + </el-form-item> + <el-form-item label="宸ュ巶" prop="werks"> + <!-- <el-input v-model="form.werks" placeholder="璇疯緭鍏ュ伐鍘�" /> --> + </el-form-item> + <el-form-item label="搴撲綅缁勫悕绉�" prop="locationGroupName"> + <el-input v-model="form.locationGroupName" placeholder="璇疯緭鍏ュ簱浣嶇粍鍚嶇О" /> + </el-form-item> + <el-form-item label="浠撳簱缂栧彿" prop="lgort"> + <el-input v-model="form.lgort" placeholder="璇疯緭鍏ヤ粨搴撶紪鍙�" /> + </el-form-item> + <el-form-item label="鎻忚堪" prop="description"> + <el-input v-model="form.description" placeholder="璇疯緭鍏ユ弿杩�" /> + </el-form-item> + <el-form-item label="鐘舵��" prop="state"> + <el-input v-model="form.state" placeholder="璇疯緭鍏ョ姸鎬�" /> + </el-form-item> + <!-- <el-form-item label="鏈�鍚庢洿鏂颁汉id" prop="lastUpdatedUserId"> + <el-input v-model="form.lastUpdatedUserId" placeholder="璇疯緭鍏ユ渶鍚庢洿鏂颁汉id" /> + </el-form-item> + <el-form-item label="鏈�鍚庢洿鏂颁汉濮撳悕" prop="lastUpdatedUserName"> + <el-input v-model="form.lastUpdatedUserName" placeholder="璇疯緭鍏ユ渶鍚庢洿鏂颁汉濮撳悕" /> + </el-form-item> + <el-form-item label="鏈�鍚庢洿鏂版椂闂�" prop="lastUpdatedDateTime"> + <el-date-picker clearable + v-model="form.lastUpdatedDateTime" + type="datetime" + value-format="yyyy-MM-dd HH:mm:ss" + placeholder="璇烽�夋嫨鏈�鍚庢洿鏂版椂闂�"> + </el-date-picker> + </el-form-item> --> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button :loading="buttonLoading" type="primary" @click="submitForm">纭� 瀹�</el-button> + <el-button @click="cancel">鍙� 娑�</el-button> + </div> + </el-dialog> + </div> +</template> + +<script> +import { listLocationGroup, getLocationGroup, delLocationGroup, addLocationGroup, updateLocationGroup } from "@/api/basicData/locationGroup"; + +export default { + name: "LocationGroup", + data() { + return { + // 鎸夐挳loading + buttonLoading: false, + // 閬僵灞� + loading: true, + // 閫変腑鏁扮粍 + ids: [], + // 闈炲崟涓鐢� + single: true, + // 闈炲涓鐢� + multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, + // 鎬绘潯鏁� + total: 0, + // 搴撲綅缁勮〃鏍兼暟鎹� + locationGroupList: [], + // 寮瑰嚭灞傛爣棰� + title: "", + // 鏄惁鏄剧ず寮瑰嚭灞� + open: false, + // 鏌ヨ鍙傛暟 + queryParams: { + pageNum: 1, + pageSize: 10, + locationGroupNo: undefined, + locationGroupName: undefined, + lgort: undefined, + }, + // 琛ㄥ崟鍙傛暟 + form: {}, + // 琛ㄥ崟鏍¢獙 + rules: { + locationGroupId: [ + { required: true, message: "搴撲綅缁処D涓嶈兘涓虹┖", trigger: "blur" } + ], + locationGroupNo: [ + { required: true, message: "搴撲綅缁勭紪鍙蜂笉鑳戒负绌�", trigger: "blur" } + ], + werks: [ + { required: true, message: "宸ュ巶涓嶈兘涓虹┖", trigger: "blur" } + ], + locationGroupName: [ + { required: true, message: "搴撲綅缁勫悕绉颁笉鑳戒负绌�", trigger: "blur" } + ], + lgort: [ + { required: true, message: "浠撳簱缂栧彿涓嶈兘涓虹┖", trigger: "blur" } + ], + description: [ + { required: true, message: "鎻忚堪涓嶈兘涓虹┖", trigger: "blur" } + ], + state: [ + { required: true, message: "鐘舵�佷笉鑳戒负绌�", trigger: "blur" } + ], + displayOrder: [ + { required: true, message: "鎺掑簭涓嶈兘涓虹┖", trigger: "blur" } + ], + createdUserId: [ + { required: true, message: "鍒涘缓浜篿d涓嶈兘涓虹┖", trigger: "blur" } + ], + createdUserName: [ + { required: true, message: "鍒涘缓浜哄鍚嶄笉鑳戒负绌�", trigger: "blur" } + ], + createdDateTime: [ + { required: true, message: "鍒涘缓鏃ユ湡鏃堕棿涓嶈兘涓虹┖", trigger: "blur" } + ], + auditState: [ + { required: true, message: "瀹℃牳鐘舵�佷笉鑳戒负绌�", trigger: "blur" } + ], + auditUserId: [ + { required: true, message: "瀹℃牳浜篒D涓嶈兘涓虹┖", trigger: "blur" } + ], + auditUserName: [ + { required: true, message: "瀹℃牳浜哄鍚嶄笉鑳戒负绌�", trigger: "blur" } + ], + auditDateTime: [ + { required: true, message: "瀹℃牳鏃ユ湡鏃堕棿涓嶈兘涓虹┖", trigger: "blur" } + ], + auditOpinion: [ + { required: true, message: "瀹℃牳鎰忚涓嶈兘涓虹┖", trigger: "blur" } + ], + lastUpdatedUserId: [ + { required: true, message: "鏈�鍚庢洿鏂颁汉id涓嶈兘涓虹┖", trigger: "blur" } + ], + lastUpdatedUserName: [ + { required: true, message: "鏈�鍚庢洿鏂颁汉濮撳悕涓嶈兘涓虹┖", trigger: "blur" } + ], + lastUpdatedDateTime: [ + { required: true, message: "鏈�鍚庢洿鏂版椂闂翠笉鑳戒负绌�", trigger: "blur" } + ], + isDeleted: [ + { required: true, message: "鏄惁鍒犻櫎涓嶈兘涓虹┖", trigger: "blur" } + ] + } + }; + }, + created() { + this.getList(); + }, + methods: { + /** 鏌ヨ搴撲綅缁勫垪琛� */ + getList() { + this.loading = true; + listLocationGroup(this.queryParams).then(response => { + this.locationGroupList = response.rows; + this.total = response.total; + this.loading = false; + }); + }, + // 鍙栨秷鎸夐挳 + cancel() { + this.open = false; + this.reset(); + }, + // 琛ㄥ崟閲嶇疆 + reset() { + this.form = { + locationGroupId: undefined, + locationGroupNo: undefined, + werks: undefined, + locationGroupName: undefined, + lgort: undefined, + description: undefined, + state: undefined, + displayOrder: undefined, + createdUserId: undefined, + createdUserName: undefined, + createdDateTime: undefined, + auditState: undefined, + auditUserId: undefined, + auditUserName: undefined, + auditDateTime: undefined, + auditOpinion: undefined, + lastUpdatedUserId: undefined, + lastUpdatedUserName: undefined, + lastUpdatedDateTime: undefined, + isDeleted: undefined + }; + this.resetForm("form"); + }, + /** 鎼滅储鎸夐挳鎿嶄綔 */ + handleQuery() { + this.queryParams.pageNum = 1; + this.getList(); + }, + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + resetQuery() { + this.resetForm("queryForm"); + this.handleQuery(); + }, + // 澶氶�夋閫変腑鏁版嵁 + handleSelectionChange(selection) { + this.ids = selection.map(item => item.locationGroupId) + this.single = selection.length!==1 + this.multiple = !selection.length + }, + /** 鏂板鎸夐挳鎿嶄綔 */ + handleAdd() { + this.reset(); + this.open = true; + this.title = "娣诲姞搴撲綅缁�"; + }, + /** 淇敼鎸夐挳鎿嶄綔 */ + handleUpdate(row) { + this.loading = true; + this.reset(); + const locationGroupId = row.locationGroupId || this.ids + getLocationGroup(locationGroupId).then(response => { + this.loading = false; + this.form = response.data; + this.open = true; + this.title = "淇敼搴撲綅缁�"; + }); + }, + /** 鎻愪氦鎸夐挳 */ + submitForm() { + this.$refs["form"].validate(valid => { + if (valid) { + this.buttonLoading = true; + if (this.form.locationGroupId != null) { + updateLocationGroup(this.form).then(response => { + this.$modal.msgSuccess("淇敼鎴愬姛"); + this.open = false; + this.getList(); + }).finally(() => { + this.buttonLoading = false; + }); + } else { + addLocationGroup(this.form).then(response => { + this.$modal.msgSuccess("鏂板鎴愬姛"); + this.open = false; + this.getList(); + }).finally(() => { + this.buttonLoading = false; + }); + } + } + }); + }, + /** 鍒犻櫎鎸夐挳鎿嶄綔 */ + handleDelete(row) { + const locationGroupIds = row.locationGroupId || this.ids; + this.$modal.confirm('鏄惁纭鍒犻櫎搴撲綅缁勭紪鍙蜂负"' + locationGroupIds + '"鐨勬暟鎹」锛�').then(() => { + this.loading = true; + return delLocationGroup(locationGroupIds); + }).then(() => { + this.loading = false; + this.getList(); + this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + }).catch(() => { + }).finally(() => { + this.loading = false; + }); + }, + /** 瀵煎嚭鎸夐挳鎿嶄綔 */ + handleExport() { + this.download('system/locationGroup/export', { + ...this.queryParams + }, `locationGroup_${new Date().getTime()}.xlsx`) + } + } +}; +</script> diff --git a/src/views/basicData/warehouse/addModal.vue b/src/views/basicData/warehouse/addModal.vue new file mode 100644 index 0000000..b680dc8 --- /dev/null +++ b/src/views/basicData/warehouse/addModal.vue @@ -0,0 +1,247 @@ +<template> + <!-- 娣诲姞鎴栦慨鏀笽QC妫�楠岄」鐩璇濇 --> + <el-dialog + :title="title" + :visible.sync="open" + width="750px" + custom-class="madelClass" + :destroyOnClose="true" + > + <div class="contbox"> + <el-form + ref="form" + v-if="open" + :model="form" + :rules="rules" + :disabled="isCheck" + > + <el-form-item + v-for="(item, index) in formItem" + :key="index" + :label="item.label" + :prop="item.prop" + label-width="120px" + :class="item.component == 'inputNumber' ? 'itemFixed' : ''" + > + <template v-if="item.component == 'input'"> + <el-input + v-model="form[item.prop]" + :readonly="item.readonly" + :placeholder=" + item.prop == 'checkItemNo' ? '鑷姩鐢熸垚' : '璇疯緭鍏�' + item.label + " + /> + </template> + <template v-if="item.component == 'inputNumber'"> + <el-input-number + v-model="form[item.prop]" + :label="'璇疯緭鍏�' + item.label" + ></el-input-number> + </template> + <template v-if="item.component == 'textarea'"> + <el-input + type="textarea" + :rows="2" + :placeholder="'璇疯緭鍏�' + item.label" + v-model="form[item.prop]" + > + </el-input> + </template> + <template v-if="item.component == 'select'"> + <template v-if="item.prop == 'werks'"> + <el-select + v-model="form[item.prop]" + :placeholder="'璇烽�夋嫨' + item.label" + v-if="item.prop == 'werks'" + style="width: 100%" + > + <el-option + v-for="dict in werksList" + :key="dict.werks" + :label="dict.werksName" + :value="dict.werks" + > + </el-option> + </el-select> + </template> + + <template v-if="item.prop == 'type'"> + <el-select + v-model="form[item.prop]" + :placeholder="'璇烽�夋嫨' + item.label" + v-if="item.prop == 'type'" + style="width: 100%" + > + <el-option + v-for="dict in werksList" + :key="dict.werks" + :label="dict.werksName" + :value="dict.werks" + > + </el-option> + </el-select> + </template> + + <template v-if="item.prop == 'isUseLocation'"> + <el-select + v-model="form[item.prop]" + :placeholder="'璇烽�夋嫨' + item.label" + v-if="item.prop == 'isUseLocation'" + style="width: 100%" + > + <el-option + v-for="dict in dict.type.isenable" + :key="dict.value" + :label="dict.label" + :value="dict.value" + > + </el-option> + </el-select> + </template> + </template> + </el-form-item> + </el-form> + </div> + + <div slot="footer" class="dialog-footer"> + <el-button + v-if="!isCheck" + :loading="buttonLoading" + type="primary" + @click="submitForm" + >纭� 瀹�</el-button + > + <el-button @click="cancel">鍙� 娑�</el-button> + </div> + </el-dialog> +</template> + +<script> +import { formatData, formrRquired, formatDataItem } from "./info.data"; +import { getWarehouse, addWarehouse, updateWarehouse } from "@/api/basicData/warehouse"; +import { listwerkshouse } from "@/api/basicData/location"; +export default { + name: "checkItemAdd", + components: {}, + dicts: ["isenable"], + data() { + return { + form: JSON.parse(JSON.stringify(formatData)), + rules: formrRquired, + open: false, + title: "", + buttonLoading: false, + isCheck: false, + werksList: [], + }; + }, + + computed: { + formItem() { + return formatDataItem; + }, + }, + watch:{ + open(val){ + if(!val){ + this.$refs["form"].resetFields(); + + } + + } + }, + mounted() { + listwerkshouse({ + pageNum: 1, + pageSize: 99, + }).then(res =>{ + console.log(res, '宸ュ巶'); + this.werksList = res.rows; + }) + }, + methods: { + /** 鎻愪氦鎸夐挳 */ + submitForm() { + this.$refs["form"].validate((valid) => { + if (valid) { + this.buttonLoading = true; + if (this.form.warehouseId != null) { + updateWarehouse(this.form) + .then((response) => { + this.$modal.msgSuccess("淇敼鎴愬姛"); + this.open = false; + this.$emit("getList"); + }) + .finally(() => { + this.buttonLoading = false; + }); + } else { + addWarehouse(this.form) + .then((response) => { + this.$modal.msgSuccess("鏂板鎴愬姛"); + this.open = false; + this.$emit("getList"); + }) + .finally(() => { + this.buttonLoading = false; + }); + } + } + }); + }, + // 鍙栨秷鎸夐挳 + cancel() { + this.reset(); + }, + reset() { + this.$refs["form"].resetFields(); + this.open = false; + this.isCheck = false; + }, + elDialogShow(type, info = "") { + this.open = true; + if (type == 1) { + this.title = "妫�娴嬮」鐩坊鍔�"; + this.isCheck = false; + } else if (type == 2) { + this.isCheck = false; + this.getDetailse(info); + this.title = "妫�娴嬮」鐩紪杈�"; + } else { + this.title = "妫�娴嬮」鐩煡鐪�"; + this.isCheck = true; + this.getDetailse(info); + } + this.$nextTick(()=>{ + + }) + }, + getDetailse(id) { + getWarehouse(id).then((res) => { + if (res.code === 200) { + this.form = res.data; + } + }); + }, + }, +}; +</script> + +<style lang="less" scoped> +.contbox { + max-height: 60vh !important; + overflow: auto; + box-sizing: border-box; + padding: 0 20px; +} +.itemFixed { + display: inline-block !important; +} +.itemFixed:first-child { + display: block !important; +} +::v-deep .is-disabled .el-input__inner { + color: #606266 !important; +} +// ::v-deep .el-input.is-disabled .el-input__inner +</style> diff --git a/src/views/basicData/warehouse/index.vue b/src/views/basicData/warehouse/index.vue index f1a2275..9312fc2 100644 --- a/src/views/basicData/warehouse/index.vue +++ b/src/views/basicData/warehouse/index.vue @@ -1,425 +1,227 @@ <template> - <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> - <el-form-item label="宸ュ巶" prop="werks"> - <el-input - v-model.trim="queryParams.werks" - placeholder="璇疯緭鍏ュ伐鍘�" - clearable - @keyup.enter.native="handleQuery" - /> - </el-form-item> - <el-form-item label="鍚嶇О" prop="warehouseName"> - <el-input - v-model.trim="queryParams.warehouseName" - placeholder="璇疯緭鍏ュ悕绉�" - clearable - @keyup.enter.native="handleQuery" - /> - </el-form-item> - - <el-form-item label="缂栧彿" prop="lgort"> - <el-input - v-model.trim="queryParams.lgort" - placeholder="璇疯緭鍏ョ紪鍙�" - clearable - @keyup.enter.native="handleQuery" - /> - </el-form-item> - - <el-form-item label="鐘舵��" prop="state"> - <el-input - v-model.trim="queryParams.state" - placeholder="璇疯緭鍏ョ姸鎬�" - clearable - @keyup.enter.native="handleQuery" - /> - </el-form-item> - <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> - <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> - </el-form-item> - </el-form> - - <el-row :gutter="10" class="mb8"> - <el-col :span="1.5"> - <el-button - type="primary" - plain - icon="el-icon-plus" - size="mini" - @click="handleAdd" - v-hasPermi="['system:warehouse:add']" - >鏂板</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="success" - plain - icon="el-icon-edit" - size="mini" - :disabled="single" - @click="handleUpdate" - v-hasPermi="['system:warehouse:edit']" - >淇敼</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="danger" - plain - icon="el-icon-delete" - size="mini" - :disabled="multiple" - @click="handleDelete" - v-hasPermi="['system:warehouse:remove']" - >鍒犻櫎</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="warning" - plain - icon="el-icon-download" - size="mini" - @click="handleExport" - v-hasPermi="['system:warehouse:export']" - >瀵煎嚭</el-button> - </el-col> - <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> - </el-row> - - <el-table v-loading="loading" border :data="warehouseList" @selection-change="handleSelectionChange"> - <el-table-column type="selection" width="55" align="center" /> - <el-table-column - label="搴忓彿" - type="index" - fixed - width="50" /> - <!-- <el-table-column label="浠撳簱ID" align="center" prop="warehouseId" v-if="true"/> --> - <el-table-column label="浠撳簱缂栧彿" align="center" prop="lgort" /> - <el-table-column label="鍚嶇О" align="center" prop="warehouseName" /> - <el-table-column label="宸ュ巶" align="center" prop="werks" /> - <el-table-column label="绫诲埆" align="center" prop="type" /> - <el-table-column label="鏄惁鍚敤" align="center" prop="isUseLocation" > - <template slot-scope="scope"> - <dict-tag :options="dict.type.isenable" :value="scope.row.isUseLocation"/> + <el-main class="contbox" ref="contBox"> + <div class="head" ref="headBox"> + <BaseSearch + @getList="getList" + :formItemList="searchFormSchema" + @search="getList" + @showSearchChange="getElHeight(28)" + > + <template #actionButton> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="handleAdd" + v-hasPermi="['iqc_checkItem_create']" + >鏂板</el-button + > + </el-col> + <el-col :span="1.5"> + <el-button + type="success" + plain + icon="el-icon-edit" + size="mini" + @click="handleUpdate" + v-hasPermi="['iqc_checkItem_edit']" + >淇敼</el-button + > + </el-col> + <el-col :span="1.5"> + <el-button + type="danger" + plain + icon="el-icon-delete" + size="mini" + @click="handleDelete" + v-hasPermi="['iqc_checkItem_delete']" + >鍒犻櫎</el-button + > + </el-col> </template> - </el-table-column> - <!-- <el-table-column label="绠$悊鍛業D" align="center" prop="userId" /> --> - <el-table-column label="绠$悊鍛樺悕绉�" align="center" prop="userName" /> - <el-table-column label="绠$悊鍛樼數璇�" align="center" prop="userPhone" /> - <el-table-column label="鍧愭爣X" align="center" prop="coordinateX" /> - <el-table-column label="鍧愭爣Y" align="center" prop="coordinateY" /> - <el-table-column label="鎻忚堪" align="center" prop="description" /> - <!-- <el-table-column label="鐘舵��" align="center" prop="state" /> --> - <el-table-column label="鏈�鍚庢洿鏂颁汉id" align="center" prop="lastUpdatedUserId" /> - <el-table-column label="鏈�鍚庢洿鏂颁汉濮撳悕" align="center" prop="lastUpdatedUserName" /> - <el-table-column label="鏈�鍚庢洿鏂版椂闂�" align="center" prop="lastUpdatedDateTime" width="180"> - <template slot-scope="scope"> - <span>{{ parseTime(scope.row.lastUpdatedDateTime, '{y}-{m}-{d}') }}</span> - </template> - </el-table-column> - <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> - <template slot-scope="scope"> - <el-button - size="mini" - type="text" - icon="el-icon-edit" - @click="handleUpdate(scope.row)" - v-hasPermi="['system:warehouse:edit']" - >淇敼</el-button> - <el-button - size="mini" - type="text" - icon="el-icon-delete" - @click="handleDelete(scope.row)" - v-hasPermi="['system:warehouse:remove']" - >鍒犻櫎</el-button> - </template> - </el-table-column> - </el-table> - - <pagination - v-show="total>0" - :total="total" - :page.sync="queryParams.pageNum" - :limit.sync="queryParams.pageSize" - @pagination="getList" - /> - - <!-- 娣诲姞鎴栦慨鏀逛粨搴撳璇濇 --> - <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body> - <el-form ref="form" :model="form" :rules="rules" label-width="80px"> - <el-form-item label="浠撳簱缂栧彿" prop="lgort"> - <el-input v-model.trim="form.lgort" placeholder="璇疯緭鍏ヤ粨搴撶紪鍙�" /> - </el-form-item> - <el-form-item label="鍚嶇О" prop="warehouseName"> - <el-input v-model.trim="form.warehouseName" placeholder="璇疯緭鍏ュ悕绉�" /> - </el-form-item> - <el-form-item label="宸ュ巶" prop="werks"> - <el-input v-model.trim="form.werks" placeholder="璇疯緭鍏ュ伐鍘�" /> - </el-form-item> - <el-form-item label="绫诲埆" prop="type"> - <el-input v-model.trim="form.type" placeholder="璇疯緭鍏ョ被鍒�" /> - </el-form-item> - <el-form-item label="鏄惁鍚敤" prop="isUseLocation"> - <!-- <el-input v-model.trim="form.isUseLocation" placeholder="璇疯緭鍏�0,涓嶅惎鐢� - 1,鍚敤" /> --> - <el-select v-model="form.isUseLocation" placeholder="鏄惁鍚敤" clearable> - <el-option - v-for="dict in dict.type.isenable" - :key="dict.value" - :label="dict.label" - :value="dict.value" - /> - </el-select> - </el-form-item> - <el-form-item label="绠$悊鍛樺悕绉�" prop="userId"> - <el-input v-model.trim="form.userName" placeholder="璇疯緭鍏ョ鐞嗗憳鍚嶇О" /> - </el-form-item> - <el-form-item label="绠$悊鍛樼數璇�" prop="userPhone"> - <el-input v-model.trim="form.userPhone" placeholder="璇疯緭鍏ョ鐞嗗憳鐢佃瘽" /> - </el-form-item> - <el-form-item label="鍧愭爣X" prop="coordinateX"> - <el-input v-model.trim="form.coordinateX" placeholder="璇疯緭鍏ュ潗鏍嘪" /> - </el-form-item> - <el-form-item label="鍧愭爣Y" prop="coordinateY"> - <el-input v-model.trim="form.coordinateY" placeholder="璇疯緭鍏ュ潗鏍嘫" /> - </el-form-item> - <el-form-item label="鎻忚堪" prop="description"> - <el-input v-model.trim="form.description" placeholder="璇疯緭鍏ユ弿杩�" /> - </el-form-item> - <!-- <el-form-item label="鐘舵��" prop="state"> - <el-input v-model.trim="form.state" placeholder="璇疯緭鍏ョ姸鎬�" /> - </el-form-item> --> - <!-- <el-form-item label="鏈�鍚庢洿鏂颁汉id" prop="lastUpdatedUserId"> - <el-input v-model.trim="form.lastUpdatedUserId" placeholder="璇疯緭鍏ユ渶鍚庢洿鏂颁汉id" /> - </el-form-item> - <el-form-item label="鏈�鍚庢洿鏂颁汉濮撳悕" prop="lastUpdatedUserName"> - <el-input v-model.trim="form.lastUpdatedUserName" placeholder="璇疯緭鍏ユ渶鍚庢洿鏂颁汉濮撳悕" /> - </el-form-item> - <el-form-item label="鏈�鍚庢洿鏂版椂闂�" prop="lastUpdatedDateTime"> - <el-date-picker clearable - v-model="form.lastUpdatedDateTime" - type="datetime" - value-format="yyyy-MM-dd HH:mm:ss" - placeholder="璇烽�夋嫨鏈�鍚庢洿鏂版椂闂�"> - </el-date-picker> - </el-form-item> --> - </el-form> - <div slot="footer" class="dialog-footer"> - <el-button :loading="buttonLoading" type="primary" @click="submitForm">纭� 瀹�</el-button> - <el-button @click="cancel">鍙� 娑�</el-button> - </div> - </el-dialog> - </div> + </BaseSearch> + </div> + <TableCom + :column="tabiInfo.columns" + :table-data="tabiInfo.tableData" + :table-loading="tabiInfo.tableLoading" + :isSelection="tabiInfo.isSelection" + :height="elementHeight" + rowKey="warehouseId" + ref="tabel" + @checkData="checkData" + @checkLook="checkInfo" + > + <template slot="checkType" slot-scope="scope"> + <dict-tag + :options="dict.type.check_type" + :value="scope.row.checkType" + /> + </template> + <template slot="isAutoCheck" slot-scope="scope"> + <dict-tag + :options="dict.type.is_auto_check" + :value="scope.row.isAutoCheck" + /> + </template> + <template slot="isRequired" slot-scope="scope"> + <dict-tag + :options="dict.type.is_required" + :value="scope.row.isRequired" + /> + </template> + <template slot="isToSpc" slot-scope="scope"> + <dict-tag :options="dict.type.is_to_spc" :value="scope.row.isToSpc" /> + </template> + <template slot="status" slot-scope="scope"> + <dict-tag :options="dict.type.status" :value="scope.row.status" /> + </template> + </TableCom> + <div class="pagination" ref="pagination"> + <pagination + v-show="pageInfo.pageTotal > 0" + :total="pageInfo.pageTotal" + :page.sync="pageInfo.currentPage" + :limit.sync="pageInfo.pageSize" + @pagination="getList" + /> + </div> + <AddaddModal ref="addaddModal" @getList="getList" /> + </el-main> </template> <script> -import { listWarehouse, getWarehouse, delWarehouse, addWarehouse, updateWarehouse } from "@/api/basicData/warehouse"; +import TableCom from "@/components/Table/index"; +import BaseSearch from "@/components/Table/BaseSearch"; + +import { columns, searchFormSchema } from "./info.data"; +import mixin from "@/components/Table/mixins/resize"; +import { listWarehouse, delWarehouse } from "@/api/basicData/warehouse"; +import AddaddModal from "./addModal"; export default { name: "Warehouse", - dicts: ['isenable'], + components: { TableCom, BaseSearch, AddaddModal }, + mixins: [mixin], + dicts: ["check_type", "is_auto_check", "is_required", "is_to_spc", "status"], data() { return { - // 鎸夐挳loading - buttonLoading: false, - // 閬僵灞� - loading: true, - // 閫変腑鏁扮粍 - ids: [], - // 闈炲崟涓鐢� - single: true, - // 闈炲涓鐢� - multiple: true, - // 鏄剧ず鎼滅储鏉′欢 - showSearch: true, - // 鎬绘潯鏁� - total: 0, - // 浠撳簱琛ㄦ牸鏁版嵁 - warehouseList: [], - // 寮瑰嚭灞傛爣棰� - title: "", - // 鏄惁鏄剧ず寮瑰嚭灞� - open: false, - // 鏌ヨ鍙傛暟 - queryParams: { - pageNum: 1, - pageSize: 10, - warehouseName: undefined, - werks: undefined, - type: undefined, - state: undefined, + searchFormSchema: searchFormSchema, + tabiInfo: { + columns: columns, + tableData: [], + tableLoading: false, + isSelection: true, + rowClassName: "rowClassName", }, - // 琛ㄥ崟鍙傛暟 - form: {}, - // 琛ㄥ崟鏍¢獙 - rules: { - warehouseId: [ - { required: true, message: "浠撳簱ID涓嶈兘涓虹┖", trigger: "blur" } - ], - lgort: [ - { required: true, message: "浠撳簱缂栧彿涓嶈兘涓虹┖", trigger: "blur" } - ], - warehouseName: [ - { required: true, message: "鍚嶇О涓嶈兘涓虹┖", trigger: "blur" } - ], - werks: [ - { required: true, message: "宸ュ巶涓嶈兘涓虹┖", trigger: "blur" } - ], - type: [ - { required: true, message: "绫诲埆涓嶈兘涓虹┖", trigger: "change" } - ], - // isUseLocation: [ - // { required: true, message: "0,涓嶅惎鐢� - // 1,鍚敤涓嶈兘涓虹┖", trigger: "blur" } - // ], - userId: [ - { required: true, message: "绠$悊鍛業D涓嶈兘涓虹┖", trigger: "blur" } - ], - userPhone: [ - { required: true, message: "绠$悊鍛樼數璇濅笉鑳戒负绌�", trigger: "blur" } - ], - coordinateX: [ - { required: true, message: "鍧愭爣X涓嶈兘涓虹┖", trigger: "blur" } - ], - coordinateY: [ - { required: true, message: "鍧愭爣Y涓嶈兘涓虹┖", trigger: "blur" } - ], - description: [ - { required: true, message: "鎻忚堪涓嶈兘涓虹┖", trigger: "blur" } - ], - state: [ - { required: true, message: "鐘舵�佷笉鑳戒负绌�", trigger: "blur" } - ], - - } + pageInfo: { + pageSize: 10, + pageTotal: 0, + currentPage: 1, + }, + visible: false, + ids: [], + open: false, }; }, - created() { + mounted() { this.getList(); }, methods: { - /** 鏌ヨ浠撳簱鍒楄〃 */ - getList() { - this.loading = true; - listWarehouse(this.queryParams).then(response => { - this.warehouseList = response.rows; - this.total = response.total; - this.loading = false; - }); - }, - // 鍙栨秷鎸夐挳 - cancel() { - this.open = false; - this.reset(); - }, - // 琛ㄥ崟閲嶇疆 - reset() { - this.form = { - warehouseId: undefined, - lgort: undefined, - warehouseName: undefined, - werks: undefined, - type: undefined, - isUseLocation: undefined, - userId: undefined, - userPhone: undefined, - coordinateX: undefined, - coordinateY: undefined, - description: undefined, - state: undefined, - displayOrder: undefined, - createdUserId: undefined, - createdUserName: undefined, - createdDateTime: undefined, - lastUpdatedUserId: undefined, - lastUpdatedUserName: undefined, - lastUpdatedDateTime: undefined, - isDeleted: undefined + getList(info = {}) { + this.ids = []; + this.tabiInfo.tableLoading = true; + let params = { + pageSize: this.pageInfo.pageSize, + pageNum: this.pageInfo.currentPage, + bizType: 10, + ...info, }; - this.resetForm("form"); - }, - /** 鎼滅储鎸夐挳鎿嶄綔 */ - handleQuery() { - this.queryParams.pageNum = 1; - this.getList(); - }, - /** 閲嶇疆鎸夐挳鎿嶄綔 */ - resetQuery() { - this.resetForm("queryForm"); - this.handleQuery(); - }, - // 澶氶�夋閫変腑鏁版嵁 - handleSelectionChange(selection) { - this.ids = selection.map(item => item.warehouseId) - this.single = selection.length!==1 - this.multiple = !selection.length - }, - /** 鏂板鎸夐挳鎿嶄綔 */ - handleAdd() { - this.reset(); - this.open = true; - this.title = "娣诲姞浠撳簱"; - }, - /** 淇敼鎸夐挳鎿嶄綔 */ - handleUpdate(row) { - this.loading = true; - this.reset(); - const warehouseId = row.warehouseId || this.ids - getWarehouse(warehouseId).then(response => { - this.loading = false; - this.form = response.data; - this.open = true; - this.title = "淇敼浠撳簱"; - }); - }, - /** 鎻愪氦鎸夐挳 */ - submitForm() { - this.$refs["form"].validate(valid => { - if (valid) { - this.buttonLoading = true; - if (this.form.warehouseId != null) { - updateWarehouse(this.form).then(response => { - this.$modal.msgSuccess("淇敼鎴愬姛"); - this.open = false; - this.getList(); - }).finally(() => { - this.buttonLoading = false; - }); - } else { - addWarehouse(this.form).then(response => { - this.$modal.msgSuccess("鏂板鎴愬姛"); - this.open = false; - this.getList(); - }).finally(() => { - this.buttonLoading = false; - }); - } + listWarehouse(params).then((res) => { + if (res.code == 200) { + this.pageInfo.pageTotal = res.total; + this.tabiInfo.tableData = res.rows; + this.tabiInfo.tableLoading = false; } }); }, - /** 鍒犻櫎鎸夐挳鎿嶄綔 */ - handleDelete(row) { - const warehouseIds = row.warehouseId || this.ids; - this.$modal.confirm('鏄惁纭鍒犻櫎浠撳簱缂栧彿涓�"' + warehouseIds + '"鐨勬暟鎹」锛�').then(() => { - this.loading = true; - return delWarehouse(warehouseIds); - }).then(() => { - this.loading = false; - this.getList(); - this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => { - }).finally(() => { - this.loading = false; - }); + checkData(data) { + if (data.length) { + this.ids = data.map((item) => { + return item.warehouseId; + }); + } else { + this.ids = []; + } }, - /** 瀵煎嚭鎸夐挳鎿嶄綔 */ - handleExport() { - this.download('system/warehouse/export', { - ...this.queryParams - }, `warehouse_${new Date().getTime()}.xlsx`) - } - } + handleAdd() { + this.$refs.addaddModal.elDialogShow(1); + }, + checkInfo(info) { + this.$refs.addaddModal.elDialogShow(3, info.warehouseId); + }, + /** 淇敼鎸夐挳鎿嶄綔 */ + handleUpdate() { + if (this.ids.length > 1) { + this.$message({ + message: "鍙兘鎿嶄綔鍗曟潯鏁版嵁锛�", + type: "warning", + }); + return; + } else if (this.ids.length < 1) { + this.$message({ + message: "璇烽�夋嫨鏁版嵁", + type: "warning", + }); + return; + } + this.$refs.addaddModal.elDialogShow(2, this.ids[0]); + }, + handleDelete() { + const warehouseIds = this.ids; + + if (warehouseIds.length) { + this.$modal + .confirm( + '鏄惁纭鍒犻櫎宸查�変腑鐨勬暟鎹」锛�' + ) + .then(() => { + this.tabiInfo.tableLoading = true; + return delWarehouse(warehouseIds); + }) + .then(() => { + this.tabiInfo.tableLoading = false; + this.ids = []; + this.getList(); + this.$message({ + message: "鍒犻櫎鎴愬姛", + type: "success", + }); + }) + .catch(() => {}) + .finally(() => { + this.tabiInfo.tableLoading = false; + }); + } else { + this.$message({ + message: "璇烽�夋嫨鏁版嵁", + type: "warning", + }); + } + }, + }, }; </script> + +<style lang="less" scoped> +.rowClassName { + height: 50px; +} +.contbox { + width: 100; + height: 100%; +} +</style> diff --git a/src/views/basicData/warehouse/info.data.js b/src/views/basicData/warehouse/info.data.js new file mode 100644 index 0000000..74776e9 --- /dev/null +++ b/src/views/basicData/warehouse/info.data.js @@ -0,0 +1,263 @@ +import * as vars from "@/variableSet/columns"; + + +export const columns = [ + { + label: '缂栧彿', + align: 'left', + prop: 'lgort', + width: vars.checkItemNo, + fixed: 'left', + tooltip: true, + }, + { + label: '鍚嶇О', + align: 'left', + prop: 'warehouseName', + width: vars.checkItemName, + fixed: 'left', + }, + { + label: '宸ュ巶', + align: 'left', + prop: 'werks', + width: vars.checkItemName, + fixed: 'left', + }, + { + label: '绫诲瀷', + align: 'left', + prop: 'type', + width: vars.checkItemName, + + }, + { + label: '鏄惁鍚敤', + prop: 'isUseLocation', + width: vars.checkType, + dataType: 'slot', + slot: 'isUseLocation' + }, + { + label: '绠$悊鍛樺悕绉�', + align: 'left', + prop: 'userName', + width: vars.checkStandard, + }, + { + label: '绠$悊鍛樼數璇�', + align: 'left', + prop: 'userPhone', + width: vars.standardVal, + }, + { + label: '鍧愭爣X', + align: 'left', + prop: 'coordinateX', + width: vars.standardHigh, + }, + { + label: '鍧愭爣Y', + align: 'left', + prop: 'coordinateY', + width: vars.standardLow, + }, + { + label: '鎻忚堪', + align: 'left', + prop: 'description', + width: vars.description, + tooltip: true, + }, + { + label: '鏈�鍚庢洿鏂颁汉濮撳悕', + align: 'left', + prop: 'lastUpdatedUserName', + width: vars.lastUpdatedUserName, + }, + { + label: '鏈�鍚庢洿鏂版棩鏈熸椂闂�', + align: 'left', + prop: 'lastUpdatedDateTime', + width: vars.lastUpdatedDateTime, + }, + { + dataType: 'option', + label: '鎿嶄綔', + width: '80', + align: 'center', + fixed: 'right', + hasPermi: 'iqc_checkItem_check', + operation: [ + { + name: '鏌ョ湅', + size: 'mini', + plain: true, + typeText: 4 + } + ] + + } +]; +export const searchFormSchema = [ + // { + // field: 'werks', + // label: '宸ュ巶:', + // labelWidth: 80, + // component: 'Select', + // componentProps: { + // placeholder: '璇烽�夋嫨', + // }, + // }, + { + field: 'warehouseName', + label: '鍚嶇О:', + labelWidth: 80, + component: 'Input', + componentProps: { + placeholder: '璇疯緭鍏�', + }, + }, + { + field: 'lgort', + label: '缂栧彿:', + labelWidth: 80, + component: 'Input', + componentProps: { + placeholder: '璇疯緭鍏�', + }, + }, + // { + // field: 'state', + // label: '鐘舵��:', + // labelWidth: 80, + // component: 'Select', + // componentProps: { + // options: [ + // { label: '鍚敤', value: '1' }, + // { label: '绂佺敤', value: '0' }, + // ], + // }, + // multiple: false, + // }, + +]; + +export const formatData = { + warehouseId: undefined, + lgort: undefined, + warehouseName: undefined, + werks: undefined, + type: undefined, + isUseLocation: undefined, + userId: undefined, + userPhone: undefined, + coordinateX: undefined, + coordinateY: undefined, + description: undefined, + state: undefined, + displayOrder: undefined, + createdUserId: undefined, + createdUserName: undefined, + createdDateTime: undefined, + lastUpdatedUserId: undefined, + lastUpdatedUserName: undefined, + lastUpdatedDateTime: undefined, + isDeleted: undefined +}; + +export const formrRquired = { + warehouseId: [ + { required: true, message: "浠撳簱ID涓嶈兘涓虹┖", trigger: "blur" } + ], + lgort: [ + { required: true, message: "浠撳簱缂栧彿涓嶈兘涓虹┖", trigger: "blur" } + ], + warehouseName: [ + { required: true, message: "鍚嶇О涓嶈兘涓虹┖", trigger: "blur" } + ], + werks: [ + { required: true, message: "宸ュ巶涓嶈兘涓虹┖", trigger: "blur" } + ], + type: [ + { required: true, message: "绫诲埆涓嶈兘涓虹┖", trigger: "change" } + ], + // isUseLocation: [ + // { required: true, message: "0,涓嶅惎鐢� + // 1,鍚敤涓嶈兘涓虹┖", trigger: "blur" } + // ], + userId: [ + { required: true, message: "绠$悊鍛業D涓嶈兘涓虹┖", trigger: "blur" } + ], + userPhone: [ + { required: true, message: "绠$悊鍛樼數璇濅笉鑳戒负绌�", trigger: "blur" } + ], + coordinateX: [ + { required: true, message: "鍧愭爣X涓嶈兘涓虹┖", trigger: "blur" } + ], + coordinateY: [ + { required: true, message: "鍧愭爣Y涓嶈兘涓虹┖", trigger: "blur" } + ], + // description: [ + // { required: true, message: "鎻忚堪涓嶈兘涓虹┖", trigger: "blur" } + // ], + // state: [ + // { required: true, message: "鐘舵�佷笉鑳戒负绌�", trigger: "blur" } + // ], +} +export const formatDataItem = [ + { + label: "浠撳簱缂栧彿", + prop: 'lgort', + component: 'input', + // readonly: true + }, + { + label: "鍚嶇О", + prop: 'warehouseName', + component: 'input' + + }, + { + label: "宸ュ巶", + prop: 'werks', + component: 'select', + }, + { + label: "绫诲瀷", + prop: 'type', + component: 'select' + }, + { + label: "鏄惁鍚敤", + prop: 'isUseLocation', + component: 'select' + }, + { + label: "绠$悊鍛樺悕绉�", + prop: 'userId', + component: 'input' + }, + { + label: "绠$悊鍛樼數璇�", + prop: 'userPhone', + component: 'input' + }, + { + label: "鍧愭爣X", + prop: 'coordinateX', + component: 'inputNumber' + }, + { + label: "鍧愭爣Y", + prop: 'coordinateY', + component: 'inputNumber' + }, + + { + label: "鎻忚堪", + prop: 'description', + component: 'textarea' + }, + +] \ No newline at end of file diff --git a/src/views/basicData/warehouse/linshi.vue b/src/views/basicData/warehouse/linshi.vue new file mode 100644 index 0000000..16f2ef3 --- /dev/null +++ b/src/views/basicData/warehouse/linshi.vue @@ -0,0 +1,425 @@ +<template> + <div class="app-container"> + <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> + <el-form-item label="宸ュ巶" prop="werks"> + <el-input + v-model.trim="queryParams.werks" + placeholder="璇疯緭鍏ュ伐鍘�" + clearable + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鍚嶇О" prop="warehouseName"> + <el-input + v-model.trim="queryParams.warehouseName" + placeholder="璇疯緭鍏ュ悕绉�" + clearable + @keyup.enter.native="handleQuery" + /> + </el-form-item> + + <el-form-item label="缂栧彿" prop="lgort"> + <el-input + v-model.trim="queryParams.lgort" + placeholder="璇疯緭鍏ョ紪鍙�" + clearable + @keyup.enter.native="handleQuery" + /> + </el-form-item> + + <el-form-item label="鐘舵��" prop="state"> + <el-input + v-model.trim="queryParams.state" + placeholder="璇疯緭鍏ョ姸鎬�" + clearable + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="handleAdd" + v-hasPermi="['system:warehouse:add']" + >鏂板</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="success" + plain + icon="el-icon-edit" + size="mini" + :disabled="single" + @click="handleUpdate" + v-hasPermi="['system:warehouse:edit']" + >淇敼</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="danger" + plain + icon="el-icon-delete" + size="mini" + :disabled="multiple" + @click="handleDelete" + v-hasPermi="['system:warehouse:remove']" + >鍒犻櫎</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="warning" + plain + icon="el-icon-download" + size="mini" + @click="handleExport" + v-hasPermi="['system:warehouse:export']" + >瀵煎嚭</el-button> + </el-col> + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> + </el-row> + + <el-table v-loading="loading" border :data="warehouseList" @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55" align="center" /> + <el-table-column + label="搴忓彿" + type="index" + fixed + width="50" /> + <!-- <el-table-column label="浠撳簱ID" align="center" prop="warehouseId" v-if="true"/> --> + <el-table-column label="浠撳簱缂栧彿" align="center" prop="lgort" /> + <el-table-column label="鍚嶇О" align="center" prop="warehouseName" /> + <el-table-column label="宸ュ巶" align="center" prop="werks" /> + <el-table-column label="绫诲瀷" align="center" prop="type" /> + <el-table-column label="鏄惁鍚敤" align="center" prop="isUseLocation" > + <template slot-scope="scope"> + <dict-tag :options="dict.type.isenable" :value="scope.row.isUseLocation"/> + </template> + </el-table-column> + <!-- <el-table-column label="绠$悊鍛業D" align="center" prop="userId" /> --> + <el-table-column label="绠$悊鍛樺悕绉�" align="center" prop="userName" /> + <el-table-column label="绠$悊鍛樼數璇�" align="center" prop="userPhone" /> + <el-table-column label="鍧愭爣X" align="center" prop="coordinateX" /> + <el-table-column label="鍧愭爣Y" align="center" prop="coordinateY" /> + <el-table-column label="鎻忚堪" align="center" prop="description" /> + <!-- <el-table-column label="鐘舵��" align="center" prop="state" /> --> + <el-table-column label="鏈�鍚庢洿鏂颁汉id" align="center" prop="lastUpdatedUserId" /> + <el-table-column label="鏈�鍚庢洿鏂颁汉濮撳悕" align="center" prop="lastUpdatedUserName" /> + <el-table-column label="鏈�鍚庢洿鏂版椂闂�" align="center" prop="lastUpdatedDateTime" width="180"> + <template slot-scope="scope"> + <span>{{ parseTime(scope.row.lastUpdatedDateTime, '{y}-{m}-{d}') }}</span> + </template> + </el-table-column> + <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> + <template slot-scope="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="handleUpdate(scope.row)" + v-hasPermi="['system:warehouse:edit']" + >淇敼</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row)" + v-hasPermi="['system:warehouse:remove']" + >鍒犻櫎</el-button> + </template> + </el-table-column> + </el-table> + + <pagination + v-show="total>0" + :total="total" + :page.sync="queryParams.pageNum" + :limit.sync="queryParams.pageSize" + @pagination="getList" + /> + + <!-- 娣诲姞鎴栦慨鏀逛粨搴撳璇濇 --> + <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body> + <el-form ref="form" :model="form" :rules="rules" label-width="80px"> + <el-form-item label="浠撳簱缂栧彿" prop="lgort"> + <el-input v-model.trim="form.lgort" placeholder="璇疯緭鍏ヤ粨搴撶紪鍙�" /> + </el-form-item> + <el-form-item label="鍚嶇О" prop="warehouseName"> + <el-input v-model.trim="form.warehouseName" placeholder="璇疯緭鍏ュ悕绉�" /> + </el-form-item> + <el-form-item label="宸ュ巶" prop="werks"> + <el-input v-model.trim="form.werks" placeholder="璇疯緭鍏ュ伐鍘�" /> + </el-form-item> + <el-form-item label="绫诲埆" prop="type"> + <el-input v-model.trim="form.type" placeholder="璇疯緭鍏ョ被鍒�" /> + </el-form-item> + <el-form-item label="鏄惁鍚敤" prop="isUseLocation"> + <!-- <el-input v-model.trim="form.isUseLocation" placeholder="璇疯緭鍏�0,涓嶅惎鐢� + 1,鍚敤" /> --> + <el-select v-model="form.isUseLocation" placeholder="鏄惁鍚敤" clearable> + <el-option + v-for="dict in dict.type.isenable" + :key="dict.value" + :label="dict.label" + :value="dict.value" + /> + </el-select> + </el-form-item> + <el-form-item label="绠$悊鍛樺悕绉�" prop="userId"> + <el-input v-model.trim="form.userName" placeholder="璇疯緭鍏ョ鐞嗗憳鍚嶇О" /> + </el-form-item> + <el-form-item label="绠$悊鍛樼數璇�" prop="userPhone"> + <el-input v-model.trim="form.userPhone" placeholder="璇疯緭鍏ョ鐞嗗憳鐢佃瘽" /> + </el-form-item> + <el-form-item label="鍧愭爣X" prop="coordinateX"> + <el-input v-model.trim="form.coordinateX" placeholder="璇疯緭鍏ュ潗鏍嘪" /> + </el-form-item> + <el-form-item label="鍧愭爣Y" prop="coordinateY"> + <el-input v-model.trim="form.coordinateY" placeholder="璇疯緭鍏ュ潗鏍嘫" /> + </el-form-item> + <el-form-item label="鎻忚堪" prop="description"> + <el-input v-model.trim="form.description" placeholder="璇疯緭鍏ユ弿杩�" /> + </el-form-item> + <!-- <el-form-item label="鐘舵��" prop="state"> + <el-input v-model.trim="form.state" placeholder="璇疯緭鍏ョ姸鎬�" /> + </el-form-item> --> + <!-- <el-form-item label="鏈�鍚庢洿鏂颁汉id" prop="lastUpdatedUserId"> + <el-input v-model.trim="form.lastUpdatedUserId" placeholder="璇疯緭鍏ユ渶鍚庢洿鏂颁汉id" /> + </el-form-item> + <el-form-item label="鏈�鍚庢洿鏂颁汉濮撳悕" prop="lastUpdatedUserName"> + <el-input v-model.trim="form.lastUpdatedUserName" placeholder="璇疯緭鍏ユ渶鍚庢洿鏂颁汉濮撳悕" /> + </el-form-item> + <el-form-item label="鏈�鍚庢洿鏂版椂闂�" prop="lastUpdatedDateTime"> + <el-date-picker clearable + v-model="form.lastUpdatedDateTime" + type="datetime" + value-format="yyyy-MM-dd HH:mm:ss" + placeholder="璇烽�夋嫨鏈�鍚庢洿鏂版椂闂�"> + </el-date-picker> + </el-form-item> --> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button :loading="buttonLoading" type="primary" @click="submitForm">纭� 瀹�</el-button> + <el-button @click="cancel">鍙� 娑�</el-button> + </div> + </el-dialog> + </div> +</template> + +<script> +import { listWarehouse, getWarehouse, delWarehouse, addWarehouse, updateWarehouse } from "@/api/basicData/warehouse"; + +export default { + name: "Warehouse", + dicts: ['isenable'], + data() { + return { + // 鎸夐挳loading + buttonLoading: false, + // 閬僵灞� + loading: true, + // 閫変腑鏁扮粍 + ids: [], + // 闈炲崟涓鐢� + single: true, + // 闈炲涓鐢� + multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, + // 鎬绘潯鏁� + total: 0, + // 浠撳簱琛ㄦ牸鏁版嵁 + warehouseList: [], + // 寮瑰嚭灞傛爣棰� + title: "", + // 鏄惁鏄剧ず寮瑰嚭灞� + open: false, + // 鏌ヨ鍙傛暟 + queryParams: { + pageNum: 1, + pageSize: 10, + warehouseName: undefined, + werks: undefined, + type: undefined, + state: undefined, + }, + // 琛ㄥ崟鍙傛暟 + form: {}, + // 琛ㄥ崟鏍¢獙 + rules: { + warehouseId: [ + { required: true, message: "浠撳簱ID涓嶈兘涓虹┖", trigger: "blur" } + ], + lgort: [ + { required: true, message: "浠撳簱缂栧彿涓嶈兘涓虹┖", trigger: "blur" } + ], + warehouseName: [ + { required: true, message: "鍚嶇О涓嶈兘涓虹┖", trigger: "blur" } + ], + werks: [ + { required: true, message: "宸ュ巶涓嶈兘涓虹┖", trigger: "blur" } + ], + type: [ + { required: true, message: "绫诲埆涓嶈兘涓虹┖", trigger: "change" } + ], + // isUseLocation: [ + // { required: true, message: "0,涓嶅惎鐢� + // 1,鍚敤涓嶈兘涓虹┖", trigger: "blur" } + // ], + userId: [ + { required: true, message: "绠$悊鍛業D涓嶈兘涓虹┖", trigger: "blur" } + ], + userPhone: [ + { required: true, message: "绠$悊鍛樼數璇濅笉鑳戒负绌�", trigger: "blur" } + ], + coordinateX: [ + { required: true, message: "鍧愭爣X涓嶈兘涓虹┖", trigger: "blur" } + ], + coordinateY: [ + { required: true, message: "鍧愭爣Y涓嶈兘涓虹┖", trigger: "blur" } + ], + description: [ + { required: true, message: "鎻忚堪涓嶈兘涓虹┖", trigger: "blur" } + ], + state: [ + { required: true, message: "鐘舵�佷笉鑳戒负绌�", trigger: "blur" } + ], + + } + }; + }, + created() { + this.getList(); + }, + methods: { + /** 鏌ヨ浠撳簱鍒楄〃 */ + getList() { + this.loading = true; + listWarehouse(this.queryParams).then(response => { + this.warehouseList = response.rows; + this.total = response.total; + this.loading = false; + }); + }, + // 鍙栨秷鎸夐挳 + cancel() { + this.open = false; + this.reset(); + }, + // 琛ㄥ崟閲嶇疆 + reset() { + this.form = { + warehouseId: undefined, + lgort: undefined, + warehouseName: undefined, + werks: undefined, + type: undefined, + isUseLocation: undefined, + userId: undefined, + userPhone: undefined, + coordinateX: undefined, + coordinateY: undefined, + description: undefined, + state: undefined, + displayOrder: undefined, + createdUserId: undefined, + createdUserName: undefined, + createdDateTime: undefined, + lastUpdatedUserId: undefined, + lastUpdatedUserName: undefined, + lastUpdatedDateTime: undefined, + isDeleted: undefined + }; + this.resetForm("form"); + }, + /** 鎼滅储鎸夐挳鎿嶄綔 */ + handleQuery() { + this.queryParams.pageNum = 1; + this.getList(); + }, + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + resetQuery() { + this.resetForm("queryForm"); + this.handleQuery(); + }, + // 澶氶�夋閫変腑鏁版嵁 + handleSelectionChange(selection) { + this.ids = selection.map(item => item.warehouseId) + this.single = selection.length!==1 + this.multiple = !selection.length + }, + /** 鏂板鎸夐挳鎿嶄綔 */ + handleAdd() { + this.reset(); + this.open = true; + this.title = "娣诲姞浠撳簱"; + }, + /** 淇敼鎸夐挳鎿嶄綔 */ + handleUpdate(row) { + this.loading = true; + this.reset(); + const warehouseId = row.warehouseId || this.ids + getWarehouse(warehouseId).then(response => { + this.loading = false; + this.form = response.data; + this.open = true; + this.title = "淇敼浠撳簱"; + }); + }, + /** 鎻愪氦鎸夐挳 */ + submitForm() { + this.$refs["form"].validate(valid => { + if (valid) { + this.buttonLoading = true; + if (this.form.warehouseId != null) { + updateWarehouse(this.form).then(response => { + this.$modal.msgSuccess("淇敼鎴愬姛"); + this.open = false; + this.getList(); + }).finally(() => { + this.buttonLoading = false; + }); + } else { + addWarehouse(this.form).then(response => { + this.$modal.msgSuccess("鏂板鎴愬姛"); + this.open = false; + this.getList(); + }).finally(() => { + this.buttonLoading = false; + }); + } + } + }); + }, + /** 鍒犻櫎鎸夐挳鎿嶄綔 */ + handleDelete(row) { + const warehouseIds = row.warehouseId || this.ids; + this.$modal.confirm('鏄惁纭鍒犻櫎浠撳簱缂栧彿涓�"' + warehouseIds + '"鐨勬暟鎹」锛�').then(() => { + this.loading = true; + return delWarehouse(warehouseIds); + }).then(() => { + this.loading = false; + this.getList(); + this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + }).catch(() => { + }).finally(() => { + this.loading = false; + }); + }, + /** 瀵煎嚭鎸夐挳鎿嶄綔 */ + handleExport() { + this.download('system/warehouse/export', { + ...this.queryParams + }, `warehouse_${new Date().getTime()}.xlsx`) + } + } +}; +</script> -- Gitblit v1.9.3