qukaidi 3 éve
szülő
commit
f0c334a5fb

+ 28 - 2
src/views/workManagement/task/configuration/mainList.json

@@ -18,7 +18,7 @@
   "viewBtn": false,
   "editBtn": false,
   "delBtn": false,
-  "menuWidth": 140,
+  "menuWidth": 180,
   "searchLabelWidth": 100,
   "showSummary": true,
   "summaryText": "合计",
@@ -82,6 +82,12 @@
       ]
     },
     {
+      "label": "承做人",
+      "prop": "userid",
+      "overHidden": true,
+      "width": 150
+    },
+    {
       "label": "客户名称",
       "search": true,
       "prop": "cornId",
@@ -124,6 +130,13 @@
       "width": 120
     },
     {
+      "label": "提成",
+      "prop": "commission",
+      "overHidden": true,
+      "cell":true,
+      "width": 120
+    },
+    {
       "label": "提醒日",
       "prop": "reminderDay",
       "valueFormat": "timestamp",
@@ -132,7 +145,7 @@
       "width": 150
     },
     {
-      "label": "需求开始日期",
+      "label": "开始日期",
       "prop": "beginTime",
       "format": "yyyy-MM-dd",
       "valueFormat": "yyyy-MM-dd",
@@ -145,6 +158,19 @@
       "cell": true
     },
     {
+      "label": "完成日期",
+      "prop": "endTime",
+      "format": "yyyy-MM-dd",
+      "valueFormat": "yyyy-MM-dd",
+      "type": "date",
+      "unlinkPanels": true,
+      "searchRange": true,
+      "search": true,
+      "overHidden": true,
+      "width": 150,
+      "cell": true
+    },
+    {
       "label": "制单人",
       "prop": "createUserName",
       "disabled": true,

+ 265 - 271
src/views/workManagement/task/index.vue

@@ -1,81 +1,44 @@
 <template>
   <basic-container>
-    <avue-crud :option="option"
-               :data="dataList"
-               ref="crud"
-               v-model="form"
-               :page.sync="page"
-               :search.sync="search"
-               :table-loading="loading"
-               @search-change="searchChange"
-               @search-reset="searchReset"
-               @selection-change="selectionChange"
-               @current-change="currentChange"
-               @size-change="sizeChange"
-               @refresh-change="refreshChange"
-               @on-load="onLoad">
+    <avue-crud :option="option" :data="dataList" ref="crud" v-model="form" :page.sync="page" :search.sync="search"
+      :table-loading="loading" @search-change="searchChange" @search-reset="searchReset"
+      @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
+      @refresh-change="refreshChange" @on-load="onLoad">
       <template slot="cornIdSearch">
-        <select-component
-          v-model="search.cornId"
-          :configuration="configuration"
-        ></select-component>
+        <select-component v-model="search.cornId" :configuration="configuration"></select-component>
       </template>
       <template slot-scope="scope" slot="cornId">
         {{ scope.row.cornName }}
       </template>
       <template slot="menuLeft">
-        <el-button
-          icon="el-icon-printer"
-          size="small"
-          type="primary"
-          :loading="exportLoading"
-          @click.stop="downFile"
-        >导 出
+        <el-button icon="el-icon-printer" size="small" type="primary" :loading="exportLoading" @click.stop="downFile">导出
         </el-button>
       </template>
-      <template slot-scope="scope" slot="menu">
-        <el-button
-          type="text"
-          icon="el-icon-view"
-          size="small"
-          @click.stop="copyTo"
-        >发送
+      <template slot="userid" slot-scope="{row,index}">
+        <user-select style="width:90% !important;" v-if="row.$cellEdit" v-model="row.userName"
+          @value="(values) => value(values, row)" :configuration="UConfiguration">
+        </user-select>
+        <span v-else>{{ row.userName }}</span>
+      </template>
+      <template slot-scope="{row,index}" slot="menu">
+        <el-button type="text" icon="el-icon-view" size="small" @click.stop="copyTo">发送
+        </el-button>
+        <el-button type="text" icon="el-icon-edit" :disabled="row.status != 5" size="small"
+          @click.stop="completion(row)">完工
         </el-button>
-        <el-button
-          type="text"
-          icon="el-icon-edit"
-          :disabled="scope.row.status != 1"
-          size="small"
-          @click.stop="completion(scope.row)"
-        >完工
+        <el-button type="text" icon="el-icon-edit" size="small" @click.stop="rowCell(row)">{{ row.$cellEdit ? "保存" :
+            "修改"
+        }}
         </el-button>
       </template>
     </avue-crud>
-    <el-dialog
-      append-to-body
-      title="消息"
-      class="el-dialogDeep"
-      :visible.sync="copyToDialog"
-      width="60%"
-      :close-on-click-modal="false"
-      :destroy-on-close="true"
-      :close-on-press-escape="false"
-      v-dialog-drag
-    >
+    <el-dialog append-to-body title="消息" class="el-dialogDeep" :visible.sync="copyToDialog" width="60%"
+      :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
       <avue-form class="trading-form" :option="optionMeg" ref="formMeg" v-model="formMeg">
         <template slot="toUserId">
-          <el-select v-model="formMeg.toUserId"
-                     remote
-                     filterable
-                     clearable
-                     @change="toUserChange"
-                     :remote-method="remoteMethod"
-          >
-            <el-option
-              v-for="item in userOption"
-              :key="item.value"
-              :label="item.realName"
-              :value="item.id">
+          <el-select v-model="formMeg.toUserId" remote filterable clearable @change="toUserChange"
+            :remote-method="remoteMethod">
+            <el-option v-for="item in userOption" :key="item.value" :label="item.realName" :value="item.id">
             </el-option>
           </el-select>
         </template>
@@ -89,227 +52,258 @@
 </template>
 
 <script>
-  import option from "./configuration/mainList.json";
-  import { getFlowList } from "@/api/workManagement/mainProject";
-  import { updateItemStatus } from "@/api/workManagement/mainProject";
-  import { getUserList } from "@/api/workManagement/mainProject";
-  import { saveMessage } from "@/api/logs";
-  export default {
-    name: "customerInformation",
-    data() {
-      return {
-        loading : false,
-        exportLoading:false,
-        copyToDialog:false,
-        form: {},
-        search:{},
-        configuration:{
-          multipleChoices:false,
-          multiple:false,
-          disabled:false,
-          searchShow:true,
-          collapseTags:false,
-          clearable:true,
-          placeholder:'请点击右边按钮选择',
-          dicData:[]
-        },
-        option: option,
-        parentId:0,
-        dataList: [],
-        page: {
-          currentPage: 1,
-          total: 0,
-          pageSize: 10
-        },
-        query:{},
-        userOption:[],
-        optionMeg:{
-          emptyBtn: false,
-          submitBtn: false,
-          labelWidth: 120,
-          menuSpan: 8,
-          column: [
-            {
-              label: '抄送人',
-              prop: 'toUserId',
-              span: 12,
-              type:'select',
-              rules: [
-                {
-                  required: true,
-                  message: ' ',
-                  trigger: 'blur'
-                }
-              ]
-            },
-            {
-              label: '抄送日期',
-              prop: 'createTime',
-              type: "datetime",
-              span: 12,
-              disabled:true,
-              rules: [
-                {
-                  required: false,
-                  message: ' ',
-                  trigger: 'blur'
-                }
-              ]
-            },
-            {
-              label: '内容',
-              prop: 'messageBody',
-              span: 24,
-              rules: [
-                {
-                  required: true,
-                  message: ' ',
-                  trigger: 'blur'
-                }
-              ]
-            }
-          ]
-        },
-        formMeg:{}
-      }
-    },
-    created() {
-
-    },
-    mounted() {
-      getUserList().then(res=>{
-        res.data.data.map((item,index)=>{
-          if(index <= 20){
-            this.userOption.push(item)
-          }
-        })
-      })
-      // option.height = window.innerHeight - 350 ;
-    },
-    methods: {
-      //抄送
-      copyTo(){
-        this.formMeg = {}
-        this.copyToDialog = true;
-        let date = new Date();
-        let strDate = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
-        this.$set(this.formMeg,"createTime",strDate)
+import option from "./configuration/mainList.json";
+import { getFlowList } from "@/api/workManagement/mainProject";
+import { updateItemStatus } from "@/api/workManagement/mainProject";
+import { getUserList } from "@/api/workManagement/mainProject";
+import { saveMessage } from "@/api/logs";
+export default {
+  name: "customerInformation",
+  data() {
+    return {
+      loading: false,
+      exportLoading: false,
+      copyToDialog: false,
+      form: {},
+      search: {},
+      configuration: {
+        multipleChoices: false,
+        multiple: false,
+        disabled: false,
+        searchShow: true,
+        collapseTags: false,
+        clearable: true,
+        placeholder: '请点击右边按钮选择',
+        dicData: []
       },
-      //用户远程模糊
-      remoteMethod(query){
-        let params = {
-          realName : query
-        }
-        getUserList(params).then(res=>{
-          this.userOption = res.data.data
-        })
+      option: option,
+      parentId: 0,
+      dataList: [],
+      page: {
+        currentPage: 1,
+        total: 0,
+        pageSize: 10
       },
-      toUserChange(value){
-        this.userOption.forEach(item =>{
-          if(item.id == value){
-            this.formMeg.toUserName = item.realName
-          }
-        })
-      },
-      submitCopy(){
-        this.$refs["formMeg"].validate((valid) => {
-          if(valid){
-            saveMessage(this.formMeg).then(res=>{
-              if(res.data.success){
-                this.$message.success("抄送成功!")
-                this.copyToDialog = false
+      query: {},
+      userOption: [],
+      optionMeg: {
+        emptyBtn: false,
+        submitBtn: false,
+        labelWidth: 120,
+        menuSpan: 8,
+        column: [
+          {
+            label: '抄送人',
+            prop: 'toUserId',
+            span: 12,
+            type: 'select',
+            rules: [
+              {
+                required: true,
+                message: ' ',
+                trigger: 'blur'
+              }
+            ]
+          },
+          {
+            label: '抄送日期',
+            prop: 'createTime',
+            type: "datetime",
+            span: 12,
+            disabled: true,
+            rules: [
+              {
+                required: false,
+                message: ' ',
+                trigger: 'blur'
+              }
+            ]
+          },
+          {
+            label: '内容',
+            prop: 'messageBody',
+            span: 24,
+            rules: [
+              {
+                required: true,
+                message: ' ',
+                trigger: 'blur'
               }
-            })
+            ]
           }
-        })
+        ]
       },
-      downFile(){
-        this.exportLoading = true
-        let searchParams = Object.assign({},this.search);
-        let param = this.paramsAdjustment(searchParams)
-        getFlowList(1, 10000,param).then(res =>{
-          const fileData = this.deepClone(res.data.data.records)
-          fileData.map(item =>{
-            item.cornId = item.cornName
-          })
-          const fileColumn = this.deepClone(option.column)
-          fileColumn.shift();
-          this.$Export.excel({
-            title: "任务",
-            columns: fileColumn,
-            data: fileData,
-          });
-        }).finally(()=>{
-          this.exportLoading = false
-        })
+      formMeg: {},
+      UConfiguration: {
+        multipleChoices: false,
+        multiple: false,
+        disabled: false,
+        searchShow: true,
+        collapseTags: false,
+        placeholder: '请点击右边按钮选择',
+        dicData: []
       },
-      //完工
-      completion(row){
-        this.$confirm("确认将此任务完工?", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(() => {
-          updateItemStatus(row.id,4).then(res =>{
-            if(res.data.success){
-              this.$message({
-                type: "success",
-                message: "操作成功!"
-              });
-              this.onLoad(this.page);
+    }
+  },
+  created() {
+
+  },
+  mounted() {
+    getUserList().then(res => {
+      res.data.data.map((item, index) => {
+        if (index <= 20) {
+          this.userOption.push(item)
+        }
+      })
+    })
+    // option.height = window.innerHeight - 350 ;
+  },
+  methods: {
+    value(value, row) {
+      if (value) {
+        row.userid = value.id
+        row.deptid = value.deptId
+      }
+    },
+    rowCell(row, index) {
+      if (row.$cellEdit == true) {
+        this.$set(row, "$cellEdit", false);
+      } else {
+        this.$set(row, "$cellEdit", true);
+      }
+    },
+    //抄送
+    copyTo() {
+      this.formMeg = {}
+      this.copyToDialog = true;
+      let date = new Date();
+      let strDate = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
+      this.$set(this.formMeg, "createTime", strDate)
+    },
+    //用户远程模糊
+    remoteMethod(query) {
+      let params = {
+        realName: query
+      }
+      getUserList(params).then(res => {
+        this.userOption = res.data.data
+      })
+    },
+    toUserChange(value) {
+      this.userOption.forEach(item => {
+        if (item.id == value) {
+          this.formMeg.toUserName = item.realName
+        }
+      })
+    },
+    submitCopy() {
+      this.$refs["formMeg"].validate((valid) => {
+        if (valid) {
+          saveMessage(this.formMeg).then(res => {
+            if (res.data.success) {
+              this.$message.success("抄送成功!")
+              this.copyToDialog = false
             }
           })
-        });
-      },
-      //点击搜索按钮触发
-      searchChange(params, done) {
-        this.query = params;
-        this.page.currentPage = 1;
-        this.onLoad(this.page, params);
-        done()
-      },
-      searchReset() {
-        console.log('1')
-      },
-      selectionChange() {
-        console.log('1')
-      },
-      currentChange(val) {
-        this.page.currentPage = val
-        this.onLoad(this.page)
-      },
-      sizeChange() {
-        console.log('1')
-      },
-      refreshChange() {
-        this.onLoad(this.page)
-      },
-      paramsAdjustment(params){
-        params = Object.assign({},this.search);
-        if (params.beginTime &&  params.beginTime.length !=0) {  //发货
-          params.beginStartTime = params.beginTime[0]+ " " + "00:00:00";
-          params.beginEndTime = params.beginTime[1] + " " + "23:59:59";
-          this.$delete(params,'beginTime')
         }
-        if(!params.status){
-          params.status = "1,4,5";
-        }
-        return params
-      },
-      onLoad(page, params = {}) {
-        params =  this.paramsAdjustment(params)
-        this.loading = true
-        getFlowList(page.currentPage, page.pageSize,params).then(res =>{
-          this.dataList = res.data.data.records
-          this.page.total = res.data.data.total
-        }).finally(()=>{
-          this.loading = false
+      })
+    },
+    downFile() {
+      this.exportLoading = true
+      let searchParams = Object.assign({}, this.search);
+      let param = this.paramsAdjustment(searchParams)
+      getFlowList(1, 10000, param).then(res => {
+        const fileData = this.deepClone(res.data.data.records)
+        fileData.map(item => {
+          item.cornId = item.cornName
         })
-      },
-    }
+        const fileColumn = this.deepClone(option.column)
+        fileColumn.shift();
+        this.$Export.excel({
+          title: "任务",
+          columns: fileColumn,
+          data: fileData,
+        });
+      }).finally(() => {
+        this.exportLoading = false
+      })
+    },
+    //完工
+    completion(row) {
+      this.$confirm("确认将此任务完工?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        updateItemStatus(row.id, 4).then(res => {
+          if (res.data.success) {
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+            this.onLoad(this.page);
+          }
+        })
+      });
+    },
+    //点击搜索按钮触发
+    searchChange(params, done) {
+      this.query = params;
+      this.page.currentPage = 1;
+      this.onLoad(this.page, params);
+      done()
+    },
+    searchReset() {
+      console.log('1')
+    },
+    selectionChange() {
+      console.log('1')
+    },
+    currentChange(val) {
+      this.page.currentPage = val
+      this.onLoad(this.page)
+    },
+    sizeChange() {
+      console.log('1')
+    },
+    refreshChange() {
+      this.onLoad(this.page)
+    },
+    paramsAdjustment(params) {
+      // params = Object.assign({}, this.search);
+      // if (params.beginTime && params.beginTime.length != 0) {  //发货
+      //   params.beginStartTime = params.beginTime[0] + " " + "00:00:00";
+      //   params.beginEndTime = params.beginTime[1] + " " + "23:59:59";
+      //   this.$delete(params, 'beginTime')
+      // }
+      let data = this.deepClone(Object.assign({}, params, this.search));
+      if (data.careteTime && data.careteTime.length > 0) {
+        data = {
+          ...data,
+          beginCreateTime: data.careteTime[0],
+          endCreateTime: data.careteTime[1]
+        };
+      }
+      if (!data.status) {
+        data.status = "1,4,5";
+      }
+      return data
+    },
+    onLoad(page, params) {
+      let data = this.paramsAdjustment(params)
+
+      delete data.careteTime;
+      this.loading = true;
+      getFlowList(page.currentPage, page.pageSize, data).then(res => {
+        this.dataList = res.data.data.records
+        this.page.total = res.data.data.total
+      }).finally(() => {
+        this.loading = false
+      })
+    },
   }
+}
 </script>
 
 <style scoped>
-
 </style>