diff --git a/src/api/core/base/factory.js b/src/api/core/base/factory.js index 4a1d8105..8731bb57 100644 --- a/src/api/core/base/factory.js +++ b/src/api/core/base/factory.js @@ -33,7 +33,13 @@ export function getFactory(id) { method: 'get' }) } - +// 获得工厂code +export function getCode() { + return request({ + url: '/base/factory/getCode', + method: 'get' + }) +} // 获得工厂分页 export function getFactoryPage(query) { return request({ diff --git a/src/api/core/base/lineBindProduct.js b/src/api/core/base/lineBindProduct.js index dfca4aa1..dd1203e1 100644 --- a/src/api/core/base/lineBindProduct.js +++ b/src/api/core/base/lineBindProduct.js @@ -8,7 +8,14 @@ export function createLineBindProduct(data) { data: data }) } - +// 切换产品 +export function switchLineBindProduct(data) { + return request({ + url: '/base/line-bind-product/switch', + method: 'put', + data: data + }) +} // 更新产线目前生产产品表 主要为更新 export function updateLineBindProduct(data) { return request({ diff --git a/src/api/core/base/product.js b/src/api/core/base/product.js index abe1c2e7..dcfc1281 100644 --- a/src/api/core/base/product.js +++ b/src/api/core/base/product.js @@ -9,6 +9,13 @@ export function createProduct(data) { }) } +// 获得产品code +export function getCode() { + return request({ + url: '/base/product/getCode', + method: 'get' + }) +} // 更新产品 export function updateProduct(data) { return request({ diff --git a/src/api/core/base/productionLine.js b/src/api/core/base/productionLine.js index f76d8b99..05467e1b 100644 --- a/src/api/core/base/productionLine.js +++ b/src/api/core/base/productionLine.js @@ -8,6 +8,13 @@ export function createProductionLine(data) { data: data }) } +// 获得产线code +export function getCode() { + return request({ + url: '/base/production-line/getCode', + method: 'get' + }) +} // 更新工厂产线 export function updateProductionLine(data) { diff --git a/src/api/core/base/workshopSection.js b/src/api/core/base/workshopSection.js index be717476..b460590f 100644 --- a/src/api/core/base/workshopSection.js +++ b/src/api/core/base/workshopSection.js @@ -9,6 +9,13 @@ export function createWorkshopSection(data) { }) } +// 获得工段code +export function getCode() { + return request({ + url: '/base/workshop-section/getCode', + method: 'get' + }) +} // 更新产线工段 export function updateWorkshopSection(data) { return request({ diff --git a/src/views/core/base/factory/add-or-updata.vue b/src/views/core/base/factory/add-or-updata.vue new file mode 100644 index 00000000..64b2fa11 --- /dev/null +++ b/src/views/core/base/factory/add-or-updata.vue @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/core/base/factory/index.vue b/src/views/core/base/factory/index.vue index 7ac0a92a..7aa8a17c 100644 --- a/src/views/core/base/factory/index.vue +++ b/src/views/core/base/factory/index.vue @@ -1,258 +1,202 @@ - - - - - - - - - - - - - - - 搜索 - 重置 - - - - - - - 新增 - - - 导出 - - - - - - - - - - - - - - - - - - - - - - {{ parseTime(scope.row.createTime) }} - - - - - 修改 - 删除 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + diff --git a/src/views/core/base/lineBindProduct/index.vue b/src/views/core/base/lineBindProduct/index.vue index 66e039e9..f77b8eba 100644 --- a/src/views/core/base/lineBindProduct/index.vue +++ b/src/views/core/base/lineBindProduct/index.vue @@ -1,208 +1,103 @@ + - - - - - - 搜索 - 重置 - - - - - - - 新增 - - - 导出 - - - - - - - - - - - - {{ parseTime(scope.row.recordTime) }} - - - - - 修改 - 删除 - - - - - - - - - - - - - - - - - - - - - - + + + + + diff --git a/src/views/core/base/lineBindProduct/selectProduct.vue b/src/views/core/base/lineBindProduct/selectProduct.vue new file mode 100644 index 00000000..a9325346 --- /dev/null +++ b/src/views/core/base/lineBindProduct/selectProduct.vue @@ -0,0 +1,73 @@ + + + + + + + + + + + 取消 + + + 确定 + + + 切换 + + + + + diff --git a/src/views/core/base/lineBindProductLog/index.vue b/src/views/core/base/lineBindProductLog/index.vue index 20cc00bc..1569ba98 100644 --- a/src/views/core/base/lineBindProductLog/index.vue +++ b/src/views/core/base/lineBindProductLog/index.vue @@ -1,241 +1,147 @@ - - - - - - - - - - - - - - - - - - - 搜索 - 重置 - - - - - - - 新增 - - - 导出 - - - - - - - - - - - - {{ parseTime(scope.row.startTime) }} - - - - - {{ parseTime(scope.row.endTime) }} - - - - - 修改 - 删除 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + diff --git a/src/views/core/base/product/SmallTitle.vue b/src/views/core/base/product/SmallTitle.vue new file mode 100644 index 00000000..93b4a18f --- /dev/null +++ b/src/views/core/base/product/SmallTitle.vue @@ -0,0 +1,65 @@ + + + + + + + + + + diff --git a/src/views/core/base/product/add-or-updata.vue b/src/views/core/base/product/add-or-updata.vue new file mode 100644 index 00000000..86c387a7 --- /dev/null +++ b/src/views/core/base/product/add-or-updata.vue @@ -0,0 +1,425 @@ + + + + {{ isdetail ? '详情' : !dataForm.id ? '新增' : '编辑' }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 产品属性列表 + + + + + + + + + + + + + 返回 + + 编辑 + + + 保存 + + 添加属性 + + + + + + + + + + + diff --git a/src/views/core/base/product/attr-add.vue b/src/views/core/base/product/attr-add.vue new file mode 100644 index 00000000..d5c46d11 --- /dev/null +++ b/src/views/core/base/product/attr-add.vue @@ -0,0 +1,139 @@ + + + + + + {{ !dataForm.id ? '新增' : '编辑' }} + + + + + + + + + + + + + + + 取消 + 确定 + + + + + + + diff --git a/src/views/core/base/product/index.vue b/src/views/core/base/product/index.vue index 2781d241..693df2d9 100644 --- a/src/views/core/base/product/index.vue +++ b/src/views/core/base/product/index.vue @@ -1,498 +1,205 @@ + - - - - - - - - - - - 搜索 - - - - - - - 新增 - - - - - - - - - - - - - - {{ parseTime(scope.row.createTime) }} - - - - - - - - - - - - - - - 修改 - - - 删除 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - - diff --git a/src/views/core/base/product/unitDict.vue b/src/views/core/base/product/unitDict.vue new file mode 100644 index 00000000..94702ab4 --- /dev/null +++ b/src/views/core/base/product/unitDict.vue @@ -0,0 +1,15 @@ + + + + diff --git a/src/views/core/base/productionLine/add-or-updata.vue b/src/views/core/base/productionLine/add-or-updata.vue new file mode 100644 index 00000000..4e730f31 --- /dev/null +++ b/src/views/core/base/productionLine/add-or-updata.vue @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/core/base/productionLine/index.vue b/src/views/core/base/productionLine/index.vue index 6e8ba04f..cb0d18ae 100644 --- a/src/views/core/base/productionLine/index.vue +++ b/src/views/core/base/productionLine/index.vue @@ -1,236 +1,188 @@ - - - - - - - - - 搜索 - 重置 - - - - - - - 新增 - - - 导出 - - - - - - - - - - - - - - - {{ parseTime(scope.row.createTime) }} - - - - - 修改 - 删除 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + diff --git a/src/views/core/base/workshopSection/add-or-updata.vue b/src/views/core/base/workshopSection/add-or-updata.vue new file mode 100644 index 00000000..8d54899e --- /dev/null +++ b/src/views/core/base/workshopSection/add-or-updata.vue @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/views/core/base/workshopSection/index.vue b/src/views/core/base/workshopSection/index.vue index f4fc25e5..4829cd93 100644 --- a/src/views/core/base/workshopSection/index.vue +++ b/src/views/core/base/workshopSection/index.vue @@ -1,227 +1,188 @@ - - - - - - - - - 搜索 - 重置 - - - - - - - 新增 - - - 导出 - - - - - - - - - - - - - - - {{ parseTime(scope.row.createTime) }} - - - - - 修改 - 删除 - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + diff --git a/src/views/core/mixins/basic-add.js b/src/views/core/mixins/basic-add.js new file mode 100644 index 00000000..0b9acd23 --- /dev/null +++ b/src/views/core/mixins/basic-add.js @@ -0,0 +1,100 @@ +/* + * @Author: zwq + * @Date: 2022-08-24 11:19:43 + * @LastEditors: zwq + * @LastEditTime: 2023-08-03 14:21:04 + * @Description: + */ +export default { + data() { + /* eslint-disable */ + return { + urlOptions: { + createURL: '', + updateURL: '', + infoURL: '', + codeURL: '', + getOption: false, + isGetCode: false, + optionArrUrl: [], + optionArr: {} + }, + visible: false, + setData: false + } + }, + created() { + }, + activated() { + }, + methods: { + init(id) { + this.dataForm.id = id || ""; + this.visible = true; + if (this.urlOptions.getOption) { + this.getArr() + } + this.$nextTick(() => { + this.$refs["dataForm"].resetFields(); + if (this.dataForm.id) { + this.urlOptions.infoURL(id).then(response => { + this.dataForm = response.data; + if (this.setData) { + this.setDataForm() + } + }); + } else { + if (this.urlOptions.isGetCode) { + this.getCode() + } + } + }); + }, + getCode() { + this.urlOptions.codeURL() + .then(({ data: res }) => { + this.dataForm.code = res; + }) + .catch(() => {}); + }, + getArr() { + const params = { + pageSize: 100, + pageNo: 1, + } + this.urlOptions.optionArrUrl.forEach((item, index) => { + item(params).then(({ data: res }) => { + this.$set(this.urlOptions.optionArr, `arr${index}`, res.list) + }) + .catch(() => { + }); + }); + }, + // 表单提交 + dataFormSubmit() { + this.$refs["dataForm"].validate((valid) => { + if (!valid) { + return false; + } + // 修改的提交 + if (this.dataForm.id) { + this.urlOptions.updateURL(this.dataForm).then(response => { + this.$modal.msgSuccess("修改成功"); + this.visible = false; + this.$emit("refreshDataList"); + }); + return; + } + // 添加的提交 + this.urlOptions.createURL(this.dataForm).then(response => { + this.$modal.msgSuccess("新增成功"); + this.visible = false; + this.$emit("refreshDataList"); + }); + }); + }, + formClear() { + this.$refs.dataForm.resetFields() + } + } +} diff --git a/src/views/core/mixins/basic-page.js b/src/views/core/mixins/basic-page.js new file mode 100644 index 00000000..3efe8452 --- /dev/null +++ b/src/views/core/mixins/basic-page.js @@ -0,0 +1,168 @@ +/* + * @Author: zwq + * @Date: 2022-08-24 11:19:43 + * @LastEditors: zwq + * @LastEditTime: 2023-08-02 10:56:37 + * @Description: + */ +export default { + data() { + /* eslint-disable */ + return { + urlOptions: { + getDataListURL: '', + deleteURL: '', + statusUrl: '', + exportURL: '' + }, + tableData: [], + listQuery: { + pageSize: 10, + pageNo: 1, + total: 1, + }, + exportLoading: false, + dataListLoading: false, + addOrEditTitle: '', + addOrUpdateVisible: false, + } + }, + created() { + }, + mounted() { + this.getDataList() + }, + methods: { + // 获取数据列表 + getDataList() { + this.dataListLoading = true; + this.urlOptions.getDataListURL(this.listQuery).then(response => { + this.tableData = response.data.list; + this.total = response.data.total; + this.dataListLoading = false; + }); + }, + // 每页数 + sizeChangeHandle(val) { + this.listQuery.pageSize = val; + this.listQuery.pageNo = 1; + this.getDataList(); + }, + // 当前页 + currentChangeHandle(val) { + this.listQuery.pageNo = val; + this.getDataList(); + }, + // 新增 / 修改 + addOrUpdateHandle(id) { + this.addOrUpdateVisible = true; + this.$nextTick(() => { + this.$refs.addOrUpdate.init(id); + }); + }, + cancel(id) { + this.$refs["popover-" + id].showPopper = false; + }, + //改变状态 + changeStatus(id) { + this.$http + .post(this.urlOptions.statusUrl, { id }) + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg); + } + this.$refs["popover-" + id].showPopper = false; + this.$message({ + message: this.$t("prompt.success"), + type: "success", + duration: 500, + onClose: () => { + this.getDataList(); + }, + }); + }) + .catch(() => { }); + }, + //tableBtn点击 + handleClick(val) { + if (val.type === "edit") { + this.addOrUpdateVisible = true; + this.addOrEditTitle = "编辑"; + this.$nextTick(() => { + this.$refs.addOrUpdate.init(val.data.id); + }); + } else if (val.type === "delete") { + this.deleteHandle(val.data.id, val.data.name, val.data._pageIndex) + } else if (val.type === "change") { + this.changeStatus(val.data.id) + } else { + this.otherMethods(val) + } + }, + // 删除 + deleteHandle(id, name, index) { + this.$confirm(`确定对${name ? '[名称=' + name + ']' : '[序号=' + index + ']'}进行删除操作?`, "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }) + .then(() => { + this.urlOptions.deleteURL(id).then(({ data }) => { + this.$message({ + message: "操作成功", + type: "success", + duration: 1500, + onClose: () => { + this.getDataList(); + }, + }); + }); + }) + .catch(() => { }); + }, + //search-bar点击 + buttonClick(val) { + switch (val.btnName) { + case "search": + this.listQuery.xm1 = val.xm1; + this.listQuery.xm2 = val.xm2; + this.listQuery.pageNo = 1; + this.getDataList(); + break; + case "add": + this.addOrEditTitle = '新增' + this.addOrUpdateVisible = true; + this.addOrUpdateHandle() + break; + default: + console.log(val) + } + }, + handleCancel() { + this.$refs.addOrUpdate.formClear() + this.addOrUpdateVisible = false + this.addOrEditTitle = '' + }, + handleConfirm() { + this.$refs.addOrUpdate.dataFormSubmit() + }, + successSubmit() { + this.handleCancel() + this.getDataList() + }, + /** 导出按钮操作 */ + handleExport() { + // 处理查询参数 + let params = { ...this.queryParams }; + params.pageNo = undefined; + params.pageSize = undefined; + this.$modal.confirm('是否确认导出所有数据项?').then(() => { + this.exportLoading = true; + return this.urlOptions.exportURL(params); + }).then(response => { + this.$download.excel(response, '工厂.xls'); + this.exportLoading = false; + }).catch(() => { }); + } + } +} diff --git a/src/views/core/mixins/code-filter.js b/src/views/core/mixins/code-filter.js new file mode 100644 index 00000000..4fdf94b0 --- /dev/null +++ b/src/views/core/mixins/code-filter.js @@ -0,0 +1,99 @@ + +/* + * @Date: 2020-12-29 16:49:28 + * @LastEditors: zwq + * @LastEditTime: 2023-08-01 11:10:04 + * @FilePath: \basic-admin\src\filters\basicData\index.js + * @Description: + */ + +const table = { + eightDisciplineType: { + 1: '客诉问题', + 2: '重大质量问题', + 0: '重复发生问题', + }, + examineStatus: { + 1: '需要审批', + 0: '不需要审批', + }, + gradeFinish: { + 1: '已打分', + 0: '未打分', + }, + step: { + 0: 'D0', + 1: 'D1', + 2: 'D2', + 3: 'D3', + 4: 'D4', + 5: 'D5', + 6: 'D6', + 7: 'D7', + 8: 'D8', + }, + containmentLocaleName: + { + 1: "装配线", + 2: "生产线", + 3: "实验室", + 4: "成品在途", + 5: "第三方中间商", + }, + developCountermeasuresName: + { + 1: "让步接收", + 2: "分选返工", + 3: "隔离", + 4: "退换货", + 5: "通知供应商", + }, +} + +// 日期格式化 +export function parseTime(time, pattern) { + if (arguments.length === 0 || !time) { + return null + } + const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}' + let date + if (typeof time === 'object') { + date = time + } else { + if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { + time = parseInt(time) + } else if (typeof time === 'string') { + time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.\d{3}/gm),''); + } + if ((typeof time === 'number') && (time.toString().length === 10)) { + time = time * 1000 + } + date = new Date(time) + } + const formatObj = { + y: date.getFullYear(), + m: date.getMonth() + 1, + d: date.getDate(), + h: date.getHours(), + i: date.getMinutes(), + s: date.getSeconds(), + a: date.getDay() + } + const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => { + let value = formatObj[key] + // Note: getDay() returns 0 on Sunday + if (key === 'a') { + return ['日', '一', '二', '三', '四', '五', '六'][value] + } + if (result.length > 0 && value < 10) { + value = '0' + value + } + return value || 0 + }) + return time_str +} +export default function (dictTable) { + return function (val) { + return table?.[dictTable]?.[val] + } +}