From 0a6c53262a91869ac41bb739930e09d787b683fc Mon Sep 17 00:00:00 2001 From: DouDou <877258667@qq.com> Date: Thu, 12 Sep 2024 18:50:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E5=85=B7=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/tool/com_tool_instance_date_show.js | 13 + .../com_tool_instance_add_update.vue | 32 +- .../com_tool_instance_date_add_update.vue | 306 ++++++---------- .../com_tool_instance_date_show.vue | 328 ++++++++++++++++++ src/views/modules/tooling/manuf_tool.vue | 18 +- 5 files changed, 456 insertions(+), 241 deletions(-) create mode 100644 src/api/tool/com_tool_instance_date_show.js create mode 100644 src/views/modules/tooling/components/com_tool_instance_date_show.vue diff --git a/src/api/tool/com_tool_instance_date_show.js b/src/api/tool/com_tool_instance_date_show.js new file mode 100644 index 0000000..dafd046 --- /dev/null +++ b/src/api/tool/com_tool_instance_date_show.js @@ -0,0 +1,13 @@ +import { createAPI } from '@/utils/httpRequest.js' + +// 获取 +export const getToolInstanceDates = data => createAPI('plm/tool/getToolInstanceDates', 'POST', data) + +// 获取 +export const insertToolInstanceDate = data => createAPI('plm/tool/insertToolInstanceDate', 'POST', data) + +// 获取 +export const modifyToolInstanceDate = data => createAPI('plm/tool/modifyToolInstanceDate', 'POST', data) + +// 删除 +export const removeToolInstanceDate = data => createAPI('plm/tool/removeToolInstanceDate', 'POST', data) diff --git a/src/views/modules/tooling/components/com_tool_instance_add_update.vue b/src/views/modules/tooling/components/com_tool_instance_add_update.vue index 605132d..8327d19 100644 --- a/src/views/modules/tooling/components/com_tool_instance_add_update.vue +++ b/src/views/modules/tooling/components/com_tool_instance_add_update.vue @@ -7,7 +7,7 @@ - + @@ -291,35 +291,7 @@ export default { objectType: 'label' }, rules: { - site: [ - { - required: true, - message: ' ', - trigger: ['blur','change'] - } - ], - toolId: [ - { - required: true, - message: ' ', - trigger: ['blur','change'] - } - ], - toolDesc: [ - { - required: true, - message: ' ', - trigger: ['blur','change'] - } - ], - toolType: [ - { - required: true, - message: ' ', - trigger: ['blur','change'] - } - ], - calendarId: [ + toolInstance: [ { required: true, message: ' ', diff --git a/src/views/modules/tooling/components/com_tool_instance_date_add_update.vue b/src/views/modules/tooling/components/com_tool_instance_date_add_update.vue index 34d8178..389d930 100644 --- a/src/views/modules/tooling/components/com_tool_instance_date_add_update.vue +++ b/src/views/modules/tooling/components/com_tool_instance_date_add_update.vue @@ -1,115 +1,53 @@ @@ -120,7 +58,7 @@ import { insertToolInstanceDate, modifyToolInstanceDate, removeToolInstanceDate, -} from '@/api/tool/com_tool_instance_date_add_update.js'; +} from '@/api/tool/com_tool_instance_date_show.js'; var functionId = 'C106003003'; export default { @@ -129,79 +67,80 @@ export default { titleCon: '工具新增', showDefault: false, visible: false, - dataList:[], + addFlag: true, currentRow: {}, columnArray: [], pageData: { site: this.$store.state.user.site, username: this.$store.state.user.name, toolId: '', + toolType: '', + id: 0, toolInstance: '', - description: '', beginDate: '', endDate: '', ifsRowId: 0, ifsRowVersion: '', }, dataListLoading: false, + rules: { + beginDate: [ + { + required: true, + message: ' ', + trigger: ['blur','change'] + } + ], + }, } }, methods: { //初始化组件的参数 - init(toolInfo) { + init(toolInfo, addFlag) { this.visible = true; + this.addFlag = addFlag; //判断是否是新增 this.pageData.site = toolInfo.site; this.pageData.toolId = toolInfo.toolId; this.pageData.toolInstance = toolInfo.toolInstance; - this.pageData.description = toolInfo.description; - this.titleCon = '工具实例生命周期维护'; - //刷新工具实例下的生命周期的数据 - this.refreshToolInstanceDateList(); - }, - - /*刷新工具信息*/ - refreshToolInstanceDateList() { - getToolInstanceDates(this.pageData).then(({data}) => { - if (data.code == 200) { - this.dataList = data.rows; - } - this.dataListLoading = false - }) + //判断是否是新增 + if(!addFlag){ + this.pageData.id = toolInfo.id; + this.pageData.beginDate = toolInfo.beginDate; + this.pageData.endDate = toolInfo.endDate; + this.titleCon = '工具实例生命周期修改'; + }else { + this.pageData.beginDate = ''; + this.pageData.endDate = ''; + this.pageData.id = 0; + this.titleCon = '工具实例生命周期新增'; + } }, /*关闭modal*/ closeDialog(){ //刷新原页面的数据 - this.$emit('refreshTooInstanceData'); + this.$emit('refreshToolInstanceDateList'); //关闭当前的页面 this.visible = false; //this.$emit('update:visible', false); }, - /*新增加一行新的数据*/ - addNewToolDate(){ - let instanceDate = {'id': 0, 'site': this.pageData.site, 'toolId': this.pageData.toolId, 'toolInstance': this.pageData.toolInstance, - 'beginDate': '', 'endDate': '', 'ifsRowId': '', 'ifsRowVewrsion': ''}; - //添加对象 - this.dataList.push(instanceDate); - }, - /*检查新的工信息*/ - checkBeginDate(row, beginDate){ - if(null == beginDate || beginDate === ''){ + checkBeginDate(){ + if(null == this.pageData.beginDate || this.pageData.beginDate === ''){ this.$message.error('开始日期必须存在!'); } - const begin = this.dayjs(beginDate); + const begin = this.dayjs(this.pageData.beginDate); const now = this.dayjs(this.dayjs().format('YYYY-MM-DD')); if (begin.valueOf() < now.valueOf()) { this.$message.error('开始日期不能小于当前日期!'); - row.beginDate = ''; + this.pageData.beginDate = ''; } //如果结束的日期存在 必须大于等于当前日期 - if(!(null == row.endDate || '' === row.endDate )){ - const end = this.dayjs(row.endDate); + if(!(null == this.pageData.endDate || '' === this.pageData.endDate)){ + const end = this.dayjs(this.pageData.endDate); if (begin.valueOf() > end.valueOf()) { this.$message.error('结束日期不能小于开始日期!'); } @@ -209,107 +148,66 @@ export default { }, /*检查新的工信息*/ - checkEndDate(row, endDate){ - if(null == endDate || endDate === ''){ - endDate = '3000-01-01'; + checkEndDate(){ + if(null == this.pageData.endDate || this.pageData.endDate === ''){ + this.pageData.endDate = '3000-01-01'; } - const end = this.dayjs(endDate); + const end = this.dayjs(this.pageData.endDate); const now = this.dayjs(this.dayjs().format('YYYY-MM-DD')); if (end.valueOf() < now.valueOf()) { this.$message.error('结束日期不能小于当前日期!'); - row.endDate = ''; + this.pageData.endDate = ''; } //如果结束的日期存在 必须大于等于当前日期 - const begin = this.dayjs(row.beginDate); + const begin = this.dayjs(this.pageData.beginDate); if (begin.valueOf() > end.valueOf()) { this.$message.error('结束日期不能小于开始日期!'); - row.endDate = ''; + this.pageData.endDate = ''; } }, - /*新增工具实例的生命周期*/ - insertToolInstanceDateModal(row){ - if(null == row.beginDate || row.beginDate === ''){ + /*新增加一行新的数据*/ + saveToolInfoFun(){ + if(null == this.pageData.beginDate || this.pageData.beginDate === ''){ this.$message.error('开始日期必须存在!'); } - const begin = this.dayjs(row.beginDate); + const begin = this.dayjs(this.pageData.beginDate); const now = this.dayjs(this.dayjs().format('YYYY-MM-DD')); if (begin.valueOf() < now.valueOf()) { this.$message.error('开始日期不能小于当前日期!'); - row.beginDate = ''; + this.pageData.beginDate = ''; } //如果结束的日期存在 必须大于等于当前日期 - if(!(null == row.endDate || '' === row.endDate )){ - const end = this.dayjs(row.endDate); + if(!(null == this.pageData.endDate || '' === this.pageData.endDate )){ + const end = this.dayjs(this.pageData.endDate); if (begin.valueOf() > end.valueOf()) { this.$message.error('结束日期不能小于开始日期!'); } } - insertToolInstanceDate(row).then(({data}) =>{ - if(data.code === 200){ - this.$message.success('操作成功!'); - //刷新表格 - this.refreshToolInstanceDateList(); - }else{ - this.$message.error(data.msg); - } - }); - }, - - /*检查新的工信息*/ - saveToolInstanceDateModal(row){ - if(null == row.beginDate || row.beginDate === ''){ - this.$message.error('开始日期必须存在!'); - } - const begin = this.dayjs(row.beginDate); - const now = this.dayjs(this.dayjs().format('YYYY-MM-DD')); - if (begin.valueOf() < now.valueOf()) { - this.$message.error('开始日期不能小于当前日期!'); - row.beginDate = ''; - } - //如果结束的日期存在 必须大于等于当前日期 - if(!(null == row.endDate || '' === row.endDate )){ - const end = this.dayjs(row.endDate); - if (begin.valueOf() > end.valueOf()) { - this.$message.error('结束日期不能小于开始日期!'); - } + //区分新增还是修改 + if(this.addFlag){ + insertToolInstanceDate(this.pageData).then(({data}) =>{ + if(data.code === 200){ + this.$message.success('操作成功!'); + //刷新表格 + this.closeDialog(); + }else{ + this.$message.error(data.msg); + } + }); + }else { + modifyToolInstanceDate(this.pageData).then(({data}) =>{ + if(data.code === 200){ + this.$message.success('操作成功!'); + //刷新表格 + this.closeDialog(); + }else{ + this.$message.error(data.msg); + } + }); } - modifyToolInstanceDate(row).then(({data}) =>{ - if(data.code === 200){ - this.$message.success('操作成功!'); - //刷新表格 - this.refreshToolInstanceDateList(); - }else{ - this.$message.error(data.msg); - } - }); }, - /*删除处理业务*/ - deleteToolInstanceDateConfirm(row, index){ - //删除提示 - this.$confirm('是否删除?', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning' - }).then(() => { - //如果没有进数据库 直接删除即可 如果进入数据库需要删除数据到数据库 - if (row.id === 0){ - this.dataList.splice(index, 1); - this.$message.success('操作成功!'); - }else { - removeToolInstanceDate(row).then(({data}) => { - if (data.code === 200) { - this.$message.success('操作成功!'); - this.refreshToolInstanceDateList(); - } else { - this.$message.error(data.msg); - } - }) - } - - }) - } }, created() { // this.factoryList() @@ -322,12 +220,12 @@ export default { diff --git a/src/views/modules/tooling/manuf_tool.vue b/src/views/modules/tooling/manuf_tool.vue index 39be9db..a73bc28 100644 --- a/src/views/modules/tooling/manuf_tool.vue +++ b/src/views/modules/tooling/manuf_tool.vue @@ -132,8 +132,8 @@ - - + + @@ -150,7 +150,7 @@ import { import Chooselist from '@/views/modules/common/Chooselist'; /*选择组件*/ import toolInfoAddUpdate from "./components/com_tool_info_add_update"; /*工具新增和修改组件*/ import toolInstanceAddUpdate from "./components/com_tool_instance_add_update"; /*工具实例新增和修改组件*/ -import toolInstanceDateAddUpdate from "./components/com_tool_instance_date_add_update"; /*工具实例新增日期和修改组件*/ +import toolInstanceDateShow from "./components/com_tool_instance_date_show"; /*工具实例新增日期和修改组件*/ /*組件*/ export default { @@ -158,7 +158,7 @@ export default { Chooselist,/*选择组件*/ toolInfoAddUpdate,/*工具新增和修改组件*/ toolInstanceAddUpdate,/*工具实例新增和修改组件*/ - toolInstanceDateAddUpdate,/*工具实例新增日期和修改组件*/ + toolInstanceDateShow,/*工具实例新增日期和修改组件*/ }, name: "null", data() { @@ -419,7 +419,7 @@ export default { columnProp: 'toolInstance', headerAlign: 'center', align: 'center', - columnLabel: '工具样品', + columnLabel: '工具实例', columnHidden: false, columnImage: false, columnSortable: false, @@ -437,7 +437,7 @@ export default { columnProp: 'description', headerAlign: 'center', align: 'center', - columnLabel: '工具样品描述', + columnLabel: '工具实例描述', columnHidden: false, columnImage: false, columnSortable: false, @@ -761,11 +761,15 @@ export default { /*工具实例的生命周期*/ editToolInstanceDateModal(toolInfo){ this.currentInstanceRow = toolInfo; + //添加工具分类和分类的描述信息 + this.currentInstanceRow.toolType = this.currentRow.toolType; + this.currentInstanceRow.toolDesc = this.currentRow.toolDesc; + //判断是否选择好数据 if(Object.keys(this.currentInstanceRow).length > 0){ //打开modal的页面 this.$nextTick(() => { - this.$refs.toolInstanceDateAddUpdate.init(this.currentInstanceRow) + this.$refs.toolInstanceDateShow.init(this.currentInstanceRow) }); }else{ this.$message.error('请先选择工具实例再添加工具实例!');