|
|
@@ -181,475 +181,471 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- const workOrderStatus = [
|
|
|
- { code: 0, label: '待执行' },
|
|
|
- { code: 1, label: '已接收' },
|
|
|
- { code: 2, label: '执行中' },
|
|
|
- { code: 3, label: '待验收' },
|
|
|
- { code: 4, label: '待评价' },
|
|
|
- { code: 5, label: '已完成' },
|
|
|
- { code: 6, label: '验收不通过' }
|
|
|
- ];
|
|
|
- import {
|
|
|
- getPageSalesDemand,
|
|
|
- deleteSalesDemand,
|
|
|
- auditSalesDemand,
|
|
|
- revokeSalesDemand,
|
|
|
- closeDemand,
|
|
|
- getSalesDemandById
|
|
|
- } from '@/api/salesServiceManagement/index.js';
|
|
|
- import search from './components/searchTable.vue';
|
|
|
- import AddDialog from './components/addDialog.vue';
|
|
|
- import { getByCode } from '@/api/system/dictionary-data';
|
|
|
- import dictMixins from '@/mixins/dictMixins';
|
|
|
- import SubmitDialog from './components/submitDialog.vue';
|
|
|
+const workOrderStatus = [
|
|
|
+ { code: 0, label: '待执行' },
|
|
|
+ { code: 1, label: '已接收' },
|
|
|
+ { code: 2, label: '执行中' },
|
|
|
+ { code: 3, label: '待验收' },
|
|
|
+ { code: 4, label: '待评价' },
|
|
|
+ { code: 5, label: '已完成' },
|
|
|
+ { code: 6, label: '验收不通过' }
|
|
|
+];
|
|
|
+import {
|
|
|
+ getPageSalesDemand,
|
|
|
+ deleteSalesDemand,
|
|
|
+ auditSalesDemand,
|
|
|
+ revokeSalesDemand,
|
|
|
+ closeDemand,
|
|
|
+ getSalesDemandById
|
|
|
+} from '@/api/salesServiceManagement/index.js';
|
|
|
+import search from './components/searchTable.vue';
|
|
|
+import AddDialog from './components/addDialog.vue';
|
|
|
+import { getByCode } from '@/api/system/dictionary-data';
|
|
|
+import dictMixins from '@/mixins/dictMixins';
|
|
|
+import SubmitDialog from './components/submitDialog.vue';
|
|
|
|
|
|
- import dispatchDialog from './components/dispatchDialog.vue';
|
|
|
+import dispatchDialog from './components/dispatchDialog.vue';
|
|
|
|
|
|
- import { contactDetail } from '@/api/saleManage/contact';
|
|
|
- export default {
|
|
|
- mixins: [dictMixins],
|
|
|
- components: {
|
|
|
- search,
|
|
|
- AddDialog,
|
|
|
- SubmitDialog,
|
|
|
- dispatchDialog
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- // 表格列配置
|
|
|
- columns: [
|
|
|
- {
|
|
|
- columnKey: 'index',
|
|
|
- label: '序号',
|
|
|
- type: 'index',
|
|
|
- width: 55,
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- fixed: 'left'
|
|
|
- },
|
|
|
- {
|
|
|
- slot: 'code',
|
|
|
- prop: 'code',
|
|
|
- label: '编码',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'name',
|
|
|
- label: '需求名称',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 150
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'contactCode',
|
|
|
- label: '客户编码',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'contactName',
|
|
|
- label: '客户名称',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true
|
|
|
- },
|
|
|
- {
|
|
|
- slot: 'faultLevel',
|
|
|
- prop: 'faultLevel',
|
|
|
- label: '故障等级',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- formatter: (row) => {
|
|
|
- return this.levelData[row.faultLevel] || '';
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'createUserName',
|
|
|
- label: '创建人',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'createTime',
|
|
|
- label: '创建时间',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- formatter: (_row, _column, cellValue) => {
|
|
|
- return this.$util.toDateString(cellValue);
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'demandStatus',
|
|
|
- label: '需求状态',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- formatter: (_row, _column, cellValue) => {
|
|
|
- return cellValue == 0
|
|
|
- ? '待提交'
|
|
|
- : cellValue == 1
|
|
|
- ? '已提交'
|
|
|
- : cellValue == 2
|
|
|
- ? '已关闭'
|
|
|
- : cellValue == 3
|
|
|
- ? '已完成'
|
|
|
- : '';
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'planStatus',
|
|
|
- label: '计划状态',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- formatter: (item) => {
|
|
|
- return {
|
|
|
- 0: '待派单',
|
|
|
- 1: '已派单',
|
|
|
- 2: '执行中',
|
|
|
- 3: '已完成',
|
|
|
- 4: '已撤回',
|
|
|
- 5: '已驳回'
|
|
|
- }[item.planStatus];
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'orderStatus',
|
|
|
- label: '工单状态',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- formatter: (row) => {
|
|
|
- return workOrderStatus.find(
|
|
|
- (item) => item.code == row.orderStatus
|
|
|
- )?.label;
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- columnKey: 'action',
|
|
|
- slot: 'action',
|
|
|
- label: '操作',
|
|
|
- align: 'center',
|
|
|
- width: 230,
|
|
|
- resizable: false,
|
|
|
- showOverflowTooltip: true
|
|
|
+import { contactDetail } from '@/api/saleManage/contact';
|
|
|
+export default {
|
|
|
+ mixins: [dictMixins],
|
|
|
+ components: {
|
|
|
+ search,
|
|
|
+ AddDialog,
|
|
|
+ SubmitDialog,
|
|
|
+ dispatchDialog
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 表格列配置
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ columnKey: 'index',
|
|
|
+ label: '序号',
|
|
|
+ type: 'index',
|
|
|
+ width: 55,
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ slot: 'code',
|
|
|
+ prop: 'code',
|
|
|
+ label: '编码',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'name',
|
|
|
+ label: '需求名称',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'contactCode',
|
|
|
+ label: '客户编码',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'contactName',
|
|
|
+ label: '客户名称',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ slot: 'faultLevel',
|
|
|
+ prop: 'faultLevel',
|
|
|
+ label: '故障等级',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ formatter: (row) => {
|
|
|
+ return this.levelData[row.faultLevel] || '';
|
|
|
}
|
|
|
- ],
|
|
|
- // 加载状态
|
|
|
- loading: false,
|
|
|
- infoData: {},
|
|
|
- repairInfoLogs: [],
|
|
|
- addDialogTitle: '新建售后需求',
|
|
|
- // auditDialog: false,
|
|
|
-
|
|
|
- rowData: {},
|
|
|
- formData: {
|
|
|
- approvalResult: null,
|
|
|
- rejectCause: '',
|
|
|
- approvalUserId: '',
|
|
|
- approvalUserName: ''
|
|
|
},
|
|
|
- approvalResultOptions: [
|
|
|
- { label: '驳回', value: 0 },
|
|
|
- { label: '同意', value: 1 }
|
|
|
- ],
|
|
|
- levelData: {},
|
|
|
- levelList: [],
|
|
|
- contractInfo: {},
|
|
|
- dispatchForm: {
|
|
|
- contractInfo: {},
|
|
|
- tableList: [],
|
|
|
- contactInfoVOS: [],
|
|
|
- faultDetailList: [],
|
|
|
- associationType: '1'
|
|
|
+ {
|
|
|
+ prop: 'createUserName',
|
|
|
+ label: '创建人',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'createTime',
|
|
|
+ label: '创建时间',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ formatter: (_row, _column, cellValue) => {
|
|
|
+ return this.$util.toDateString(cellValue);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'demandStatus',
|
|
|
+ label: '需求状态',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ formatter: (_row, _column, cellValue) => {
|
|
|
+ return cellValue == 0
|
|
|
+ ? '待提交'
|
|
|
+ : cellValue == 1
|
|
|
+ ? '已提交'
|
|
|
+ : cellValue == 2
|
|
|
+ ? '已关闭'
|
|
|
+ : cellValue == 3
|
|
|
+ ? '已完成'
|
|
|
+ : '';
|
|
|
+ }
|
|
|
},
|
|
|
- kkform: {}
|
|
|
+ {
|
|
|
+ prop: 'planStatus',
|
|
|
+ label: '计划状态',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ formatter: (item) => {
|
|
|
+ return {
|
|
|
+ 0: '待派单',
|
|
|
+ 1: '已派单',
|
|
|
+ 2: '执行中',
|
|
|
+ 3: '已完成',
|
|
|
+ 4: '已撤回',
|
|
|
+ 5: '已驳回'
|
|
|
+ }[item.planStatus];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'orderStatus',
|
|
|
+ label: '工单状态',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ formatter: (row) => {
|
|
|
+ return workOrderStatus.find((item) => item.code == row.orderStatus)
|
|
|
+ ?.label;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ columnKey: 'action',
|
|
|
+ slot: 'action',
|
|
|
+ label: '操作',
|
|
|
+ align: 'center',
|
|
|
+ width: 230,
|
|
|
+ resizable: false,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ // 加载状态
|
|
|
+ loading: false,
|
|
|
+ infoData: {},
|
|
|
+ repairInfoLogs: [],
|
|
|
+ addDialogTitle: '新建售后需求',
|
|
|
+ // auditDialog: false,
|
|
|
+
|
|
|
+ rowData: {},
|
|
|
+ formData: {
|
|
|
+ approvalResult: null,
|
|
|
+ rejectCause: '',
|
|
|
+ approvalUserId: '',
|
|
|
+ approvalUserName: ''
|
|
|
+ },
|
|
|
+ approvalResultOptions: [
|
|
|
+ { label: '驳回', value: 0 },
|
|
|
+ { label: '同意', value: 1 }
|
|
|
+ ],
|
|
|
+ levelData: {},
|
|
|
+ levelList: [],
|
|
|
+ contractInfo: {},
|
|
|
+ dispatchForm: {
|
|
|
+ contractInfo: {},
|
|
|
+ tableList: [],
|
|
|
+ contactInfoVOS: [],
|
|
|
+ faultDetailList: [],
|
|
|
+ associationType: '1'
|
|
|
+ },
|
|
|
+ kkform: {}
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ btnShow() {
|
|
|
+ return (row) => {
|
|
|
+ // let flag = row.demandStatus == 0;
|
|
|
+ return row.demandStatus == 0;
|
|
|
};
|
|
|
},
|
|
|
- computed: {
|
|
|
- btnShow() {
|
|
|
- return (row) => {
|
|
|
- // let flag = row.demandStatus == 0;
|
|
|
- return row.demandStatus == 0;
|
|
|
- };
|
|
|
- },
|
|
|
- dispatchShow() {
|
|
|
- return (row) => {
|
|
|
- return !row.planStatus;
|
|
|
- // console.log(row);
|
|
|
- };
|
|
|
- }
|
|
|
+ dispatchShow() {
|
|
|
+ return (row) => {
|
|
|
+ return !row.planStatus;
|
|
|
+ // console.log(row);
|
|
|
+ };
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.requestDict('报修来源');
|
|
|
+ this.requestDict('报修状态');
|
|
|
+ this.getLevelCode('fault_level');
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ /* 表格数据源 */
|
|
|
+ datasource({ page, limit, where, order }) {
|
|
|
+ return getPageSalesDemand({ pageNum: page, size: limit, ...where });
|
|
|
},
|
|
|
- created() {
|
|
|
- this.requestDict('报修来源');
|
|
|
- this.requestDict('报修状态');
|
|
|
- this.getLevelCode('fault_level');
|
|
|
+ async changeEnable(row) {
|
|
|
+ const res = await putRoles(row);
|
|
|
+ if (res.code == 0) {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '修改成功',
|
|
|
+ customClass: 'ele-message-border'
|
|
|
+ });
|
|
|
+ this.reload();
|
|
|
+ }
|
|
|
},
|
|
|
- methods: {
|
|
|
- /* 表格数据源 */
|
|
|
- datasource({ page, limit, where, order }) {
|
|
|
- return getPageSalesDemand({ pageNum: page, size: limit, ...where });
|
|
|
- },
|
|
|
- async changeEnable(row) {
|
|
|
- const res = await putRoles(row);
|
|
|
- if (res.code == 0) {
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '修改成功',
|
|
|
- customClass: 'ele-message-border'
|
|
|
- });
|
|
|
- this.reload();
|
|
|
- }
|
|
|
- },
|
|
|
- //查询问题等级字典
|
|
|
- async getLevelCode(code) {
|
|
|
- const res = await getByCode(code);
|
|
|
- if (res?.code === '0') {
|
|
|
- let obj = {};
|
|
|
- let arr = [];
|
|
|
- res.data.map((el) => {
|
|
|
- arr.push({
|
|
|
- label: Object.values(el)[0],
|
|
|
- value: Object.keys(el)[0]
|
|
|
- });
|
|
|
- obj = { ...obj, ...el };
|
|
|
+ //查询问题等级字典
|
|
|
+ async getLevelCode(code) {
|
|
|
+ const res = await getByCode(code);
|
|
|
+ if (res?.code === '0') {
|
|
|
+ let obj = {};
|
|
|
+ let arr = [];
|
|
|
+ res.data.map((el) => {
|
|
|
+ arr.push({
|
|
|
+ label: Object.values(el)[0],
|
|
|
+ value: Object.keys(el)[0]
|
|
|
});
|
|
|
- this.levelList = arr;
|
|
|
- this.levelData = obj;
|
|
|
- }
|
|
|
- },
|
|
|
- /* 刷新表格 */
|
|
|
- reload(where) {
|
|
|
- this.$refs.table.reload({ page: 1, where });
|
|
|
- this.$emit('getToDoReminder')
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- openEdit(row, type) {
|
|
|
- this.$refs.addDialogRef.init(row, type);
|
|
|
- },
|
|
|
-
|
|
|
- handleRemove(row) {
|
|
|
- deleteSalesDemand([row.id]).then((res) => {
|
|
|
- this.$message.success('删除成功!');
|
|
|
- this.reload();
|
|
|
+ obj = { ...obj, ...el };
|
|
|
});
|
|
|
- },
|
|
|
- handleAudit(row) {
|
|
|
- this.$refs.submitRef.open(row, 'list', '列表');
|
|
|
- // this.auditDialog = true;
|
|
|
- // this.rowData = row;
|
|
|
- },
|
|
|
- // handleClose() {
|
|
|
- // this.auditDialog = false;
|
|
|
- // },
|
|
|
- // async handleSubmit() {
|
|
|
- // this.$refs.form.validate(async (valid) => {
|
|
|
- // if (valid) {
|
|
|
- // const data = this.$store.state.user.info;
|
|
|
+ this.levelList = arr;
|
|
|
+ this.levelData = obj;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /* 刷新表格 */
|
|
|
+ reload(where) {
|
|
|
+ this.$refs.table.reload({ page: 1, where });
|
|
|
+ this.$emit('getToDoReminder');
|
|
|
+ },
|
|
|
|
|
|
- // let pdata = {
|
|
|
- // id: this.rowData.id,
|
|
|
- // approvalResult: this.formData.approvalResult,
|
|
|
- // rejectCause: this.formData.rejectCause,
|
|
|
- // approvalUserId: data.userId,
|
|
|
- // approvalUserName: data.name
|
|
|
- // };
|
|
|
- // const res = await auditSalesDemand(pdata);
|
|
|
- // if (res) {
|
|
|
- // this.$message.success('审核成功!');
|
|
|
- // this.auditDialog = false;
|
|
|
- // this.reload();
|
|
|
- // }
|
|
|
- // }
|
|
|
- // });
|
|
|
- // },
|
|
|
- //
|
|
|
- async closeRevoke(row) {
|
|
|
- const res = await closeDemand(row.id);
|
|
|
- if (!res) return;
|
|
|
- this.$message.success('关闭成功!');
|
|
|
- this.reload();
|
|
|
- },
|
|
|
- async handleRevoke(row) {
|
|
|
- const res = await revokeSalesDemand({ id: row.id });
|
|
|
- if (!res) return;
|
|
|
- this.$message.success('撤回成功!');
|
|
|
+ openEdit(row, type) {
|
|
|
+ this.$refs.addDialogRef.init(row, type);
|
|
|
+ },
|
|
|
+
|
|
|
+ handleRemove(row) {
|
|
|
+ deleteSalesDemand([row.id]).then((res) => {
|
|
|
+ this.$message.success('删除成功!');
|
|
|
this.reload();
|
|
|
- },
|
|
|
- handleCommand(command, row) {
|
|
|
- if (command === 'handleRevoke') {
|
|
|
- this.handleRevoke(row);
|
|
|
- }
|
|
|
- if (command === 'handleAudit') {
|
|
|
- this.handleAudit(row);
|
|
|
- }
|
|
|
- },
|
|
|
- async dispatchFormFn(id) {
|
|
|
- const res = await getSalesDemandById(id);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleAudit(row) {
|
|
|
+ this.$refs.submitRef.open(row, 'list', '列表');
|
|
|
+ // this.auditDialog = true;
|
|
|
+ // this.rowData = row;
|
|
|
+ },
|
|
|
+ // handleClose() {
|
|
|
+ // this.auditDialog = false;
|
|
|
+ // },
|
|
|
+ // async handleSubmit() {
|
|
|
+ // this.$refs.form.validate(async (valid) => {
|
|
|
+ // if (valid) {
|
|
|
+ // const data = this.$store.state.user.info;
|
|
|
|
|
|
- this.dispatchForm = res;
|
|
|
- // detailForm = res;
|
|
|
- let productDetail = res.productDetail ? res.productDetail : [];
|
|
|
- let faultLevel = res.faultLevel ? String(res.faultLevel) : '';
|
|
|
- let faultDetailList = res.faultDetailList ? res.faultDetailList : [];
|
|
|
+ // let pdata = {
|
|
|
+ // id: this.rowData.id,
|
|
|
+ // approvalResult: this.formData.approvalResult,
|
|
|
+ // rejectCause: this.formData.rejectCause,
|
|
|
+ // approvalUserId: data.userId,
|
|
|
+ // approvalUserName: data.name
|
|
|
+ // };
|
|
|
+ // const res = await auditSalesDemand(pdata);
|
|
|
+ // if (res) {
|
|
|
+ // this.$message.success('审核成功!');
|
|
|
+ // this.auditDialog = false;
|
|
|
+ // this.reload();
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // },
|
|
|
+ //
|
|
|
+ async closeRevoke(row) {
|
|
|
+ const res = await closeDemand(row.id);
|
|
|
+ if (!res) return;
|
|
|
+ this.$message.success('关闭成功!');
|
|
|
+ this.reload();
|
|
|
+ },
|
|
|
+ async handleRevoke(row) {
|
|
|
+ const res = await revokeSalesDemand({ id: row.id });
|
|
|
+ if (!res) return;
|
|
|
+ this.$message.success('撤回成功!');
|
|
|
+ this.reload();
|
|
|
+ },
|
|
|
+ handleCommand(command, row) {
|
|
|
+ if (command === 'handleRevoke') {
|
|
|
+ this.handleRevoke(row);
|
|
|
+ }
|
|
|
+ if (command === 'handleAudit') {
|
|
|
+ this.handleAudit(row);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async dispatchFormFn(id) {
|
|
|
+ const res = await getSalesDemandById(id);
|
|
|
|
|
|
- this.$set(this.dispatchForm, 'tableList', productDetail);
|
|
|
- this.$set(this.dispatchForm, 'orderCode', res.orderCode);
|
|
|
- this.$set(this.dispatchForm, 'orderId', res.orderId);
|
|
|
- this.$set(this.dispatchForm, 'contactInfoVOS', res.contactInfoVOS);
|
|
|
- this.$set(this.dispatchForm, 'name', res.name);
|
|
|
- this.$set(this.dispatchForm, 'faultLevel', faultLevel);
|
|
|
- this.$set(this.dispatchForm, 'code', res.code);
|
|
|
- this.$set(this.dispatchForm, 'expectedTime', res.expectedTime);
|
|
|
- if (res.contactAddress) {
|
|
|
- this.$set(this.dispatchForm, 'contactAddress', res.contactAddress);
|
|
|
- }
|
|
|
- this.contactDetail(res.contactId, 'init');
|
|
|
- this.dispatchForm.associationType = res.associationType
|
|
|
- ? String(res.associationType)
|
|
|
- : '1';
|
|
|
- this.$set(this.dispatchForm, 'faultDetailList', faultDetailList);
|
|
|
- // if (faultDetailList.length > 0) {
|
|
|
- // this.isOrder = true;
|
|
|
- // }
|
|
|
- },
|
|
|
+ this.dispatchForm = res;
|
|
|
+ // detailForm = res;
|
|
|
+ let productDetail = res.productDetail ? res.productDetail : [];
|
|
|
+ let faultLevel = res.faultLevel ? String(res.faultLevel) : '';
|
|
|
+ let faultDetailList = res.faultDetailList ? res.faultDetailList : [];
|
|
|
|
|
|
- async dispatchFn(row) {
|
|
|
- const res = await getSalesDemandById(row.id);
|
|
|
- this.kkform = res;
|
|
|
- let productDetail = res.productDetail ? res.productDetail : [];
|
|
|
- let faultLevel = res.faultLevel ? String(res.faultLevel) : '';
|
|
|
- let faultDetailList = res.faultDetailList ? res.faultDetailList : [];
|
|
|
+ this.$set(this.dispatchForm, 'tableList', productDetail);
|
|
|
+ this.$set(this.dispatchForm, 'orderCode', res.orderCode);
|
|
|
+ this.$set(this.dispatchForm, 'orderId', res.orderId);
|
|
|
+ this.$set(this.dispatchForm, 'contactInfoVOS', res.contactInfoVOS);
|
|
|
+ this.$set(this.dispatchForm, 'name', res.name);
|
|
|
+ this.$set(this.dispatchForm, 'faultLevel', faultLevel);
|
|
|
+ this.$set(this.dispatchForm, 'code', res.code);
|
|
|
+ this.$set(this.dispatchForm, 'expectedTime', res.expectedTime);
|
|
|
+ if (res.contactAddress) {
|
|
|
+ this.$set(this.dispatchForm, 'contactAddress', res.contactAddress);
|
|
|
+ }
|
|
|
+ this.contactDetail(res.contactId, 'init');
|
|
|
+ this.dispatchForm.associationType = res.associationType
|
|
|
+ ? String(res.associationType)
|
|
|
+ : '1';
|
|
|
+ this.$set(this.dispatchForm, 'faultDetailList', faultDetailList);
|
|
|
+ // if (faultDetailList.length > 0) {
|
|
|
+ // this.isOrder = true;
|
|
|
+ // }
|
|
|
+ },
|
|
|
|
|
|
- this.$set(this.dispatchForm, 'tableList', productDetail);
|
|
|
- this.$set(this.dispatchForm, 'orderCode', res.orderCode);
|
|
|
- this.$set(this.dispatchForm, 'orderId', res.orderId);
|
|
|
- this.$set(this.dispatchForm, 'contactInfoVOS', res.contactInfoVOS);
|
|
|
- this.$set(this.dispatchForm, 'name', res.name);
|
|
|
- this.$set(this.dispatchForm, 'faultLevel', faultLevel);
|
|
|
- this.$set(this.dispatchForm, 'code', res.code);
|
|
|
- this.$set(this.dispatchForm, 'expectedTime', res.expectedTime);
|
|
|
- if (res.contactAddress) {
|
|
|
- this.$set(this.dispatchForm, 'contactAddress', res.contactAddress);
|
|
|
- }
|
|
|
- this.contactDetail(res.contactId, 'init');
|
|
|
- this.dispatchForm.associationType = res.associationType
|
|
|
- ? String(res.associationType)
|
|
|
- : '1';
|
|
|
- this.$set(this.dispatchForm, 'faultDetailList', faultDetailList);
|
|
|
+ async dispatchFn(row) {
|
|
|
+ const res = await getSalesDemandById(row.id);
|
|
|
+ this.kkform = res;
|
|
|
+ let productDetail = res.productDetail ? res.productDetail : [];
|
|
|
+ let faultLevel = res.faultLevel ? String(res.faultLevel) : '';
|
|
|
+ let faultDetailList = res.faultDetailList ? res.faultDetailList : [];
|
|
|
|
|
|
- // await this.dispatchFormFn(row.id);
|
|
|
- let pData = await this.handleParameter();
|
|
|
+ this.$set(this.dispatchForm, 'tableList', productDetail);
|
|
|
+ this.$set(this.dispatchForm, 'orderCode', res.orderCode);
|
|
|
+ this.$set(this.dispatchForm, 'orderId', res.orderId);
|
|
|
+ this.$set(this.dispatchForm, 'contactInfoVOS', res.contactInfoVOS);
|
|
|
+ this.$set(this.dispatchForm, 'name', res.name);
|
|
|
+ this.$set(this.dispatchForm, 'faultLevel', faultLevel);
|
|
|
+ this.$set(this.dispatchForm, 'code', res.code);
|
|
|
+ this.$set(this.dispatchForm, 'expectedTime', res.expectedTime);
|
|
|
+ if (res.contactAddress) {
|
|
|
+ this.$set(this.dispatchForm, 'contactAddress', res.contactAddress);
|
|
|
+ }
|
|
|
+ this.contactDetail(res.contactId, 'init');
|
|
|
+ this.dispatchForm.associationType = res.associationType
|
|
|
+ ? String(res.associationType)
|
|
|
+ : '1';
|
|
|
+ this.$set(this.dispatchForm, 'faultDetailList', faultDetailList);
|
|
|
|
|
|
- if (!pData) {
|
|
|
- return;
|
|
|
- }
|
|
|
+ // await this.dispatchFormFn(row.id);
|
|
|
+ let pData = await this.handleParameter();
|
|
|
|
|
|
- console.log(pData);
|
|
|
+ if (!pData) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- this.$refs.dispatchRef.open(pData, 'dispatch');
|
|
|
+ console.log(pData);
|
|
|
|
|
|
- // console.log(this.$refs.addDialogRef);
|
|
|
- },
|
|
|
- savExit() {
|
|
|
+ this.$refs.dispatchRef.open(pData, 'dispatch');
|
|
|
|
|
|
- },
|
|
|
- async contactDetail(id, type) {
|
|
|
- if (!id) {
|
|
|
- // this.contractInfo = {};
|
|
|
- return;
|
|
|
- }
|
|
|
- let { base, other, linkList } = await contactDetail(id);
|
|
|
- base.contactName = base.name;
|
|
|
- let addressName = '';
|
|
|
- if (other.addressName) {
|
|
|
- addressName += other.addressName;
|
|
|
- }
|
|
|
- if (other.address) {
|
|
|
- addressName += other.address;
|
|
|
+ // console.log(this.$refs.addDialogRef);
|
|
|
+ },
|
|
|
+ savExit() {},
|
|
|
+ async contactDetail(id, type) {
|
|
|
+ if (!id) {
|
|
|
+ // this.contractInfo = {};
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let { base, other, linkList } = await contactDetail(id);
|
|
|
+ base.contactName = base.name;
|
|
|
+ let addressName = '';
|
|
|
+ if (other.addressName) {
|
|
|
+ addressName += other.addressName;
|
|
|
+ }
|
|
|
+ if (other.address) {
|
|
|
+ addressName += other.address;
|
|
|
+ }
|
|
|
+ this.$set(this.dispatchForm, 'contractInfo', base);
|
|
|
+ },
|
|
|
+ async handleParameter() {
|
|
|
+ let data = this.dispatchForm;
|
|
|
+ if (!data.contactInfoVOS?.length) {
|
|
|
+ this.$message.warning('联系人信息至少有1条');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ // let valid = await this.$refs.infoRef.getValidate();
|
|
|
+ let expectedTime = data.expectedTime
|
|
|
+ ? this.formatDate(data.expectedTime)
|
|
|
+ : '';
|
|
|
+ let pData = {
|
|
|
+ ...this.kkform,
|
|
|
+ name: data.name,
|
|
|
+ faultLevel: data.faultLevel,
|
|
|
+ expectedTime: expectedTime,
|
|
|
+ contactId: data.contractInfo.id,
|
|
|
+ contactCode: data.contractInfo.code,
|
|
|
+ contactName: data.contractInfo.name,
|
|
|
+ orderCode: data.orderCode,
|
|
|
+ orderId: data.orderId,
|
|
|
+ contactAddress: data.contactAddress,
|
|
|
+ productDetail: data.tableList.map((item) => {
|
|
|
+ item['produceTime'] = item['produceTime'] || null;
|
|
|
+ return item;
|
|
|
+ }),
|
|
|
+ contactInfoVOS: data.contactInfoVOS,
|
|
|
+ associationType: data.associationType,
|
|
|
+ };
|
|
|
+ // 如果选的销售订单并且 没有售后对象数据
|
|
|
+ if (pData.associationType == '2' && pData.productDetail.length == 0) {
|
|
|
+ delete pData.productDetail;
|
|
|
+ pData.faultDetailList = data.faultDetailList;
|
|
|
}
|
|
|
- this.$set(this.dispatchForm, 'contractInfo', base);
|
|
|
- },
|
|
|
- async handleParameter() {
|
|
|
- let data = this.dispatchForm;
|
|
|
- if (!data.contactInfoVOS?.length) {
|
|
|
- this.$message.warning('联系人信息至少有1条');
|
|
|
- return false;
|
|
|
+ if (pData.associationType == '3' && pData.productDetail.length == 0) {
|
|
|
+ delete pData.productDetail;
|
|
|
+ pData.faultDetailList = data.faultDetailList;
|
|
|
}
|
|
|
- try {
|
|
|
- // let valid = await this.$refs.infoRef.getValidate();
|
|
|
- let expectedTime = data.expectedTime
|
|
|
- ? this.formatDate(data.expectedTime)
|
|
|
- : '';
|
|
|
- let pData = {
|
|
|
- ...this.kkform,
|
|
|
- name: data.name,
|
|
|
- faultLevel: data.faultLevel,
|
|
|
- expectedTime: expectedTime,
|
|
|
- contactId: data.contractInfo.id,
|
|
|
- contactCode: data.contractInfo.code,
|
|
|
- contactName: data.contractInfo.name,
|
|
|
- orderCode: data.orderCode,
|
|
|
- orderId: data.orderId,
|
|
|
- contactAddress: data.contactAddress,
|
|
|
- productDetail: data.tableList.map((item) => {
|
|
|
- item['produceTime'] = item['produceTime'] || null;
|
|
|
- return item;
|
|
|
- }),
|
|
|
- contactInfoVOS: data.contactInfoVOS,
|
|
|
- associationType: data.associationType
|
|
|
- };
|
|
|
- // 如果选的销售订单并且 没有售后对象数据
|
|
|
- if (pData.associationType == '2' && pData.productDetail.length == 0) {
|
|
|
- delete pData.productDetail;
|
|
|
- pData.faultDetailList = data.faultDetailList;
|
|
|
- }
|
|
|
- if (pData.associationType == '3' && pData.productDetail.length == 0) {
|
|
|
- delete pData.productDetail;
|
|
|
- pData.faultDetailList = data.faultDetailList;
|
|
|
- }
|
|
|
- return pData;
|
|
|
- } catch (err) {}
|
|
|
- },
|
|
|
- // 标准时间函数 ***
|
|
|
- formatDate(dateString) {
|
|
|
- const isStandardFormat = /^\d{4}-\d{1,2}-\d{1,2}$/.test(dateString);
|
|
|
- if (isStandardFormat) {
|
|
|
- return dateString;
|
|
|
- }
|
|
|
- try {
|
|
|
- const date = new Date(dateString);
|
|
|
- if (isNaN(date.getTime())) {
|
|
|
- throw new Error('Invalid date');
|
|
|
- }
|
|
|
- const year = date.getFullYear();
|
|
|
- const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
|
- const day = String(date.getDate()).padStart(2, '0');
|
|
|
- return `${year}-${month}-${day}`;
|
|
|
- } catch (error) {
|
|
|
- return dateString; // 转换失败时返回原始字符串
|
|
|
+ return pData;
|
|
|
+ } catch (err) {}
|
|
|
+ },
|
|
|
+ // 标准时间函数 ***
|
|
|
+ formatDate(dateString) {
|
|
|
+ const isStandardFormat = /^\d{4}-\d{1,2}-\d{1,2}$/.test(dateString);
|
|
|
+ if (isStandardFormat) {
|
|
|
+ return dateString;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ const date = new Date(dateString);
|
|
|
+ if (isNaN(date.getTime())) {
|
|
|
+ throw new Error('Invalid date');
|
|
|
}
|
|
|
+ const year = date.getFullYear();
|
|
|
+ const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
|
+ const day = String(date.getDate()).padStart(2, '0');
|
|
|
+ return `${year}-${month}-${day}`;
|
|
|
+ } catch (error) {
|
|
|
+ return dateString; // 转换失败时返回原始字符串
|
|
|
}
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
- .el-dropdown-link {
|
|
|
- cursor: pointer;
|
|
|
- color: var(--color-primary-5);
|
|
|
- }
|
|
|
+.el-dropdown-link {
|
|
|
+ cursor: pointer;
|
|
|
+ color: var(--color-primary-5);
|
|
|
+}
|
|
|
|
|
|
- .el-icon-arrow-down {
|
|
|
- font-size: 12px;
|
|
|
- }
|
|
|
+.el-icon-arrow-down {
|
|
|
+ font-size: 12px;
|
|
|
+}
|
|
|
|
|
|
- ::v-deep .seep-search {
|
|
|
- .el-input__inner::placeholder {
|
|
|
- font-size: 13px;
|
|
|
- }
|
|
|
- .el-input__inner {
|
|
|
- padding: 0 5px 0 10px;
|
|
|
- }
|
|
|
+::v-deep .seep-search {
|
|
|
+ .el-input__inner::placeholder {
|
|
|
+ font-size: 13px;
|
|
|
+ }
|
|
|
+ .el-input__inner {
|
|
|
+ padding: 0 5px 0 10px;
|
|
|
}
|
|
|
+}
|
|
|
</style>
|