{"remainingRequest":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\xypm-web\\src\\views\\StatisticalReport\\UserDefinedLedger.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xypm-web\\src\\views\\StatisticalReport\\UserDefinedLedger.vue","mtime":1675214578105},{"path":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\babel-loader\\lib\\index.js","mtime":456789000000},{"path":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\r\nimport Sortable from 'sortablejs'\r\nimport utils from '@/hotent-ui-util'\r\nimport UserDefinedLedgerDialog from '@/components/dialog/UserDefinedLedgerDialog.vue'\r\nimport ViewDefinedDialog from '@/components/dialog/ViewDefinedDialog.vue'\r\nexport default {\r\n  name: 'UserDefinedLedger',\r\n  components: {\r\n    UserDefinedLedgerDialog,\r\n    ViewDefinedDialog,\r\n  },\r\n   props: {\r\n    pid: {\r\n      type: String,\r\n      default: '',\r\n    },\r\n    isShow: {\r\n      type: Boolean,\r\n      default: true,\r\n    },\r\n    alias: {\r\n      type: String,\r\n      default: '',\r\n    },\r\n  },\r\n  data() {\r\n    return {\r\n      data: [],\r\n      pageResult: {\r\n        pageSize: 10,\r\n        pageNum: 1,\r\n        total: 0,\r\n      },\r\n      dialogVisible: false,\r\n      form: {},\r\n      propsData: [],\r\n      collapseActiveNames: ['1', '2'],\r\n      searchForm: {\r\n        name: '',\r\n      },\r\n      loading: false,\r\n      formRules: {\r\n        name: [{required: true, message: '请输入模板名称', trigger: 'blur'}],\r\n        // projectName: [\r\n        //   {required: true, message: '请选择项目名称', trigger: 'blur'},\r\n        // ],\r\n      },\r\n      disabledKeys: ['2', '3', '4'],\r\n    }\r\n  },\r\n  computed: {\r\n    deleteUrl: function () {\r\n      return window.context.cqxy + '/biz/menuFieldTemp/v1/delete'\r\n    },\r\n  },\r\n  created() {},\r\n  methods: {\r\n    // select(val, arr) {\r\n    //   this.form.projectName = arr.projectName\r\n    //   this.form.projectId = arr.id\r\n    // },\r\n    //行拖拽\r\n    rowDrop() {\r\n      const tbody = document\r\n        .getElementById('propsTable')\r\n        .querySelector('.el-table__body-wrapper tbody')\r\n      const _this = this\r\n      Sortable.create(tbody, {\r\n        onEnd({newIndex, oldIndex}) {\r\n          let arr = []\r\n          _this.propsData.forEach((item) => {\r\n            arr.push(item)\r\n          })\r\n          arr[newIndex] = arr.splice(oldIndex, 1, arr[newIndex])[0]\r\n          _this.propsData = arr\r\n        },\r\n\r\n        /* newDraggableIndex */\r\n        // onEnd({newIndex, oldIndex}) {\r\n        //   const oldRow = _this.propsData[oldIndex]\r\n        //   const newRow = _this.propsData[newIndex]\r\n        //   oldRow.oldDraggableIndex = newIndex\r\n        //   newRow.newDraggableIndex = oldIndex\r\n        //   let newRows\r\n        //   let rows\r\n        //   if (newIndex > oldIndex) {\r\n        //     newRows = _this.propsData.slice(oldIndex, newIndex + 1)\r\n        //     rows = _this.propsData.splice(oldIndex, newRows.length)\r\n        //   } else if (newIndex == oldIndex) {\r\n        //     return\r\n        //   } else {\r\n        //     newRows = _this.propsData.slice(newIndex, oldIndex + 1)\r\n        //     rows = _this.propsData.splice(newIndex, newRows.length)\r\n        //   }\r\n        //   const firstRow = rows.splice(0, 1)[0]\r\n        //   const lastRow = rows.splice(rows.length - 1, 1)[0]\r\n        //   _this.propsData.splice(newIndex, 0, lastRow, ...rows, firstRow)\r\n        // },\r\n      })\r\n    },\r\n    loadData(param, cb) {\r\n      let query = []\r\n      let search = {\r\n        name_: this.searchForm.name,\r\n      }\r\n      for (let i in search) {\r\n        if (search[i]) {\r\n          query.push({\r\n            group: 'advance',\r\n            operation: 'LIKE',\r\n            property: i,\r\n            relation: 'AND',\r\n            value: search[i],\r\n          })\r\n        }\r\n      }\r\n      if (param.querys && param.querys.length) {\r\n        param.querys.push(...query)\r\n      } else {\r\n        param.querys = query\r\n      }\r\n      this.$http\r\n        .post('${cqxy}/biz/menuFieldTemp/v1/query', param)\r\n        .then(\r\n          (resp) => {\r\n            let response = resp.data\r\n            this.data = response.rows\r\n            this.pageResult = {\r\n              page: response.page,\r\n              pageSize: response.pageSize,\r\n              total: response.total,\r\n            }\r\n          },\r\n          (error) => {\r\n            reject(error)\r\n          }\r\n        )\r\n        .finally(() => {\r\n          if (cb) {\r\n            cb()\r\n          }\r\n        })\r\n    },\r\n    handleDialogCancel() {\r\n      this.dialogVisible = false\r\n    },\r\n    handleDialogClose() {\r\n      this.dialogVisible = false\r\n    },\r\n    handleAdd() {\r\n      this.dialogVisible = true\r\n      this.form = {\r\n        // projectName:'',\r\n        // projectId:'',\r\n        name: '',\r\n        describe: '',\r\n      }\r\n      this.propsData = []\r\n      this.$nextTick(() => {\r\n        this.rowDrop()\r\n      })\r\n    },\r\n    handleAddprops() {\r\n      this.$refs.templeteConfigRef.show(this.propsData)\r\n    },\r\n    handleCommand(row) {\r\n      this.loading = true\r\n      if (row.command == 'preview') {\r\n        let param = {\r\n          id: row.row.id,\r\n        }\r\n        if(this.pid){\r\n          param.projectId=this.pid\r\n        }\r\n        this.$http\r\n          .post('${cqxy}/biz/menuFieldTemp/v1/getDataById', param)\r\n          .then((res) => {\r\n            this.loading = false\r\n            let data=res.data.value\r\n            data.id = row.row.id\r\n            if(this.pid){\r\n               data.projectId=this.pid\r\n               data.projectName=this.$route.params.projectName\r\n               data.flag=true\r\n            }\r\n            this.$refs.viewDefined.open(data)\r\n          })\r\n          .catch(() => {\r\n            this.loading = false\r\n          })\r\n      } else {\r\n        this.$http\r\n          .get('${cqxy}/biz/menuFieldTemp/v1/exportData?id=' + row.row.id)\r\n          .then((res) => {\r\n            this.loading = false\r\n          })\r\n          .catch((res) => {\r\n            this.loading = false\r\n          })\r\n      }\r\n    },\r\n    handleUp(row, index) {\r\n      if (index !== 0) {\r\n        let targetItem = row // 当前Item\r\n        let upItem = this.propsData[index - 1] // 前一个Item\r\n        let targetIndex = this.propsData[index].orderIndex // 当前ItemIndex\r\n        let upIndex = this.propsData[index - 1].orderIndex // 前一个ItemIndex\r\n        // 交换orderIndex\r\n        targetItem.orderIndex = upIndex\r\n        upItem.orderIndex = targetIndex\r\n        this.propsData.splice(index - 1, 2, targetItem, upItem)\r\n      } else {\r\n        this.$message.warning('已经处于置顶，无法上移')\r\n      }\r\n    },\r\n    handleDown(row, index) {\r\n      if (index !== this.propsData.length - 1) {\r\n        let targetItem = row // 当前Item\r\n        let downItem = this.propsData[index + 1] // 前一个Item\r\n        let targetIndex = this.propsData[index].orderIndex // 当前ItemIndex\r\n        let downIndex = this.propsData[index + 1].orderIndex // 前一个ItemIndex\r\n        // 交换orderIndex\r\n        targetItem.orderIndex = downIndex\r\n        downItem.orderIndex = targetIndex\r\n        this.propsData.splice(index, 2, downItem, targetItem)\r\n      } else {\r\n        this.$message.warning('已经处于置底，无法下移')\r\n      }\r\n    },\r\n    handleDelFields(row) {\r\n      let formData = new FormData()\r\n      formData.append('ids', row.id)\r\n      this.$http\r\n        .post('${cqxy}/biz/menuCustomizeField/v1/delete', formData)\r\n        .then((res) => {\r\n          if (res.data.state) {\r\n            let data = utils.deepClone(this.propsData)\r\n            let target = data.filter((item) => item.id != row.id)\r\n            this.propsData = target\r\n            this.$message.success(res.data.message)\r\n          } else {\r\n            this.$message.error(res.data.message)\r\n          }\r\n        })\r\n    },\r\n    findinfo() {\r\n      this.$refs.AtTable.load()\r\n    },\r\n    handleReset() {\r\n      this.searchForm = {\r\n        name: '',\r\n      }\r\n      this.$refs.AtTable.load()\r\n    },\r\n    submitPropsData(data) {\r\n      this.propsData = this.deweight(data)\r\n    },\r\n    deweight(arr) {\r\n      let map = new Map()\r\n      for (let i of arr) {\r\n        if (!map.has(i.id)) {\r\n          map.set(i.id, i)\r\n        }\r\n      }\r\n      return [...map.values()]\r\n    },\r\n    handleDialogSubmit() {\r\n      let params = {\r\n        ...this.form,\r\n        menuCustomizeFieldList: this.propsData,\r\n      }\r\n      this.$refs.form.validate((bool) => {\r\n        if (bool) {\r\n          this.$http\r\n            .post('${cqxy}/biz/menuFieldTemp/v1/save', params)\r\n            .then((res) => {\r\n              this.$message.success('保存成功')\r\n              this.dialogVisible = false\r\n              this.$refs.AtTable.load()\r\n            })\r\n        }\r\n      })\r\n    },\r\n    handleRowDBClick(data) {\r\n      this.loading = true\r\n      this.$http\r\n        .post('${cqxy}/biz/menuFieldTemp/v1/detail/' + data.id)\r\n        .then((res) => {\r\n          this.form = res.data.value\r\n          this.dialogVisible = true\r\n          this.propsData = this.form.menuCustomizeFieldList\r\n          this.propsData.forEach((item) => {\r\n            this.$set(item, 'calculationMethod', item.calculationMethod || '1')\r\n          })\r\n          this.loading = false\r\n          this.$nextTick(() => {\r\n            this.rowDrop()\r\n          })\r\n        })\r\n        .catch((err) => {\r\n          console.error(err)\r\n          this.loading = false\r\n        })\r\n    },\r\n    handleCloseViewDialog(done) {\r\n      done()\r\n    },\r\n  },\r\n}\r\n",null]}