Просмотр исходного кода

售后服务管理下 需求信息 计划信息 售后工单 前端开发

8521520123jsy 1 год назад
Родитель
Сommit
050e759293

+ 2 - 1
src/enum/dict.js

@@ -60,7 +60,8 @@ export default {
   纳税人资质: 'taxpayer',
   企业荣誉: 'enterprise_honor',
   企业规模: 'enterprise_size',
-  产地: 'purchase_origin'
+  产地: 'purchase_origin',
+  故障等级:'fault_level'
 };
 
 export const numberList = [

+ 753 - 455
src/views/salesServiceManagement/components/info.vue

@@ -1,23 +1,27 @@
 <template>
-  <el-form
-    ref="form"
-    :model="form"
-    :rules="rules"
-    label-width="100px"
-    class="create-form"
-  >
-    <headerTitle
-      title="客户信息"
-      style="margin-top: 8px"
-      v-if="isPurchaseNeed"
-    ></headerTitle>
-    <headerTitle
-      title="需求信息"
-      style="margin-top: 8px"
-      v-if="!isPurchaseNeed"
-    ></headerTitle>
-    <el-row :gutter="24">
-      <el-col :span="8">
+  <el-form ref="form" :model="form" :rules="rules" label-width="100px" class="create-form">
+    <headerTitle title="基本信息" style="margin-top: 8px" v-if="isPurchaseNeed"></headerTitle>
+    <headerTitle title="需求信息" style="margin-top: 8px" v-if="!isPurchaseNeed"></headerTitle>
+    <el-row :gutter="24" v-if="source != '报工信息'">
+      <el-col :span="6">
+        <el-form-item label="需求编码:">
+          <el-input v-model="form.code" readonly />
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item
+          label="需求名称:"
+          prop="name"
+          :rules="{
+            required: true,
+            message: '请填写需求名称',
+            trigger: 'blur'
+          }"
+        >
+          <el-input :readonly="type == 'view'" v-model="form.name" />
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
         <el-form-item
           label="客户名称:"
           prop="contractInfo.contactName"
@@ -35,7 +39,7 @@
           />
         </el-form-item>
       </el-col>
-      <el-col :span="8">
+      <el-col :span="6">
         <el-form-item
           label="发货单:"
           prop="orderCode"
@@ -53,32 +57,59 @@
           />
         </el-form-item>
       </el-col>
-      <el-col :span="8">
+      <el-col :span="6">
         <el-form-item label="客户编码:" prop="code">
           <el-input v-model="form.contractInfo.code" readonly />
         </el-form-item>
       </el-col>
-      <el-col :span="8">
+      <el-col :span="6">
         <el-form-item label="客户代号:" prop="serialNo">
           <el-input v-model="form.contractInfo.serialNo" readonly />
         </el-form-item>
       </el-col>
-      <el-col :span="8">
+      <el-col :span="6">
         <el-form-item label="业务员:" prop="salesmanName">
           <el-input v-model="form.contractInfo.salesmanName" readonly />
         </el-form-item>
       </el-col>
-      <el-col :span="8">
+      <el-col :span="6">
         <el-form-item label="报修地址:" prop="level">
           <el-input v-model="form.contactAddress" :readonly="type == 'view'" />
         </el-form-item>
       </el-col>
+      <el-col :span="6">
+        <!-- 做下拉,做字典 -->
+        <el-form-item
+          label="故障等级:"
+          prop="faultLevel"
+          :rules="{
+            required: true,
+            message: '请选择故障等级',
+            trigger: 'change'
+          }"
+        >
+          <DictSelection
+            dictName="故障等级"
+            :disabled="type == 'view'"
+            clearable
+            v-model="form.faultLevel"
+          ></DictSelection>
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="期望解决时间:" prop="expectedTime">
+          <el-date-picker
+            :readonly="type == 'view'"
+            style="width:100%"
+            v-model="form.expectedTime"
+            type="date"
+            :picker-options="pickerOptions"
+            placeholder="选择日期时间"
+          ></el-date-picker>
+        </el-form-item>
+      </el-col>
     </el-row>
-    <headerTitle
-      title="售后需求"
-      style="margin-top: 10px"
-      v-if="isPurchaseNeed"
-    ></headerTitle>
+    <headerTitle title="售后对象" style="margin-top: 10px" v-if="isPurchaseNeed"></headerTitle>
     <ele-pro-table
       ref="tableRef3"
       :columns="columnsDetail"
@@ -86,8 +117,137 @@
       :need-page="false"
       :toolbar="false"
       maxHeight="300px"
+      row-key="id"
+      :expanded-row-keys="expandedRowKeys"
+      :default-expanded-keys="expandedKeys"
     >
-      <template v-slot:type="{ row, $index }">
+      <!-- ***  -->
+      <template v-slot:expand="{ row,$index }">
+        <div
+          style=" width: calc(100% - 55px);min-height: 60px;margin-left: 55px;"
+          v-if="row.faultDetails && row.faultDetails.length > 0"
+        >
+          <ele-pro-table
+            :columns="faultList"
+            :datasource="row.faultDetails || []"
+            :need-page="false"
+            maxHeight="300px"
+            class="el-form-box"
+            :toolkit="[]"
+          >
+            <template v-slot:type="{ row,$index:idx }">
+              <el-form-item
+                :prop="`tableList.${$index}.faultDetails.${idx}.type`"
+                :rules="{
+                required: true,
+                message: '请选择故障类型',
+                trigger: 'change'
+              }"
+              >
+                <el-select v-model="row.type" :disabled="change_permission" :placeholder="`请选择`">
+                  <el-option
+                    v-for="item in typeOptions"
+                    :key="item.value"
+                    :label="item.label"
+                    :value="item.value"
+                  ></el-option>
+                </el-select>
+              </el-form-item>
+            </template>
+            <template v-slot:faultPhenomenon="{ row,$index:idx }">
+              <el-form-item
+                :prop="`tableList.${$index}.faultDetails.${idx}.faultPhenomenon`"
+                :rules="{
+                  required: true,
+                  message: '请输入故障现象',
+                  trigger: 'change'
+                }"
+              >
+                <el-input
+                  v-model="row.faultPhenomenon"
+                  placeholder="请输入"
+                  :disabled="change_permission"
+                ></el-input>
+              </el-form-item>
+            </template>
+            <template v-slot:faultReason="{ row,$index:idx }" v-if="source=='报工信息'">
+              <el-form-item
+                :prop="`tableList.${$index}.faultDetails.${idx}.faultReason`"
+                :rules="{
+                  required: true,
+                  message: '请输入故障原因',
+                  trigger: 'change'
+                }"
+              >
+                <el-input v-model="row.faultReason" placeholder="请输入" :disabled="change_permission"></el-input>
+              </el-form-item>
+            </template>
+            <template v-slot:faultReason="{ row }" v-else>
+              <el-input v-model="row.faultReason" placeholder="请输入" :disabled="change_permission"></el-input>
+            </template>
+            <template v-slot:maintenanceProcess="{ row,$index:idx }" v-if="source=='报工信息'">
+              <el-form-item
+                :prop="`tableList.${$index}.faultDetails.${idx}.maintenanceProcess`"
+                :rules="{
+                  required: true,
+                  message: '请输入维修过程',
+                  trigger: 'change'
+                }"
+              >
+                <el-input
+                  v-model="row.maintenanceProcess"
+                  placeholder="请输入"
+                  :disabled="change_permission"
+                ></el-input>
+              </el-form-item>
+            </template>
+            <template v-slot:maintenanceProcess="{ row }" v-else>
+              <el-input
+                v-model="row.maintenanceProcess"
+                placeholder="请输入"
+                :disabled="change_permission"
+              ></el-input>
+            </template>
+            <template v-slot:attachments="{ row }">
+              <fileMain v-model="row.attachments" :type="type == 'view' ? 'view' : 'add'"></fileMain>
+            </template>
+            <template v-slot:action="{ row:data,$index }">
+              <el-popconfirm class="ele-action" title="确定要删除当前故障吗?" @confirm="delSon(row,$index)">
+                <template v-slot:reference>
+                  <!-- v-if="faultOperate(data)" -->
+                  <el-link
+                    type="danger"
+                    v-if="faultOperate(data)"
+                    :underline="false"
+                    icon="el-icon-delete"
+                  >删除</el-link>
+                </template>
+              </el-popconfirm>
+              <!-- <el-link
+                type="danger"
+                :underline="false"
+                icon="el-icon-delete"
+                v-if="type != 'view'"
+                @click="del(row, $index)"
+              >删除</el-link>-->
+            </template>
+
+            <template v-slot:headerType="{ column }">
+              <span class="is-required">{{ column.label }}</span>
+            </template>
+            <template v-slot:headerPhenomenon="{ column }">
+              <span class="is-required">{{ column.label }}</span>
+            </template>
+            <template v-slot:headerMaintenance="{ column }" v-if="source=='报工信息'">
+              <span class="is-required">{{ column.label }}</span>
+            </template>
+            <template v-slot:headerFaultReason="{ column }" v-if="source=='报工信息'">
+              <span class="is-required">{{ column.label }}</span>
+            </template>
+          </ele-pro-table>
+        </div>
+      </template>
+      <!-- <template v-slot:type="{ row, $index }">
         <el-form-item
           :prop="`tableList.${$index}.type`"
           :rules="{
@@ -96,11 +256,7 @@
             trigger: 'change'
           }"
         >
-          <el-select
-            v-model="row.type"
-            :disabled="type == 'view'"
-            placeholder="请选择"
-          >
+          <el-select v-model="row.type" :disabled="type == 'view'" placeholder="请选择">
             <el-option
               v-for="item in typeOptions"
               :key="item.value"
@@ -109,8 +265,8 @@
             ></el-option>
           </el-select>
         </el-form-item>
-      </template>
-      <template v-slot:typeDescribe="{ row, $index }">
+      </template>-->
+      <!-- <template v-slot:typeDescribe="{ row, $index }">
         <el-form-item
           :prop="`tableList.${$index}.typeDescribe`"
           :rules="{
@@ -119,48 +275,42 @@
             trigger: 'change'
           }"
         >
-          <el-input
-            v-model="row.typeDescribe"
-            :disabled="type == 'view'"
-          ></el-input>
+          <el-input v-model="row.typeDescribe" :disabled="type == 'view'"></el-input>
         </el-form-item>
-      </template>
+      </template>-->
       <template v-slot:useLocation="{ row, $index }">
         <el-form-item :prop="`tableList.${$index}.useLocation`">
-          <el-input
-            v-model="row.useLocation"
-            :disabled="type == 'view'"
-          ></el-input>
+          <el-input v-model="row.useLocation" :disabled="type == 'view'"></el-input>
         </el-form-item>
       </template>
-      <template v-slot:attachments="{ row }">
-        <fileMain
-          v-model="row.attachments"
-          :type="type == 'view' ? 'view' : 'add'"
-        ></fileMain>
-      </template>
+      <!-- <template v-slot:attachments="{ row }">
+        <fileMain v-model="row.attachments" :type="type == 'view' ? 'view' : 'add'"></fileMain>
+      </template>-->
       <template v-slot:action="{ row, $index }">
+        <el-link type="primary" :underline="false" v-if="tableOperate" @click="addProblem(row)">添加故障</el-link>
         <el-link
           type="danger"
           :underline="false"
           icon="el-icon-delete"
           v-if="type != 'view'"
           @click="del(row, $index)"
-          >删除
-        </el-link>
+        >删除</el-link>
+        <!-- <el-link
+          type="danger"
+          :underline="false"
+          icon="el-icon-delete"
+          @click="del(row, $index)"
+          >查看历史记录
+        </el-link>-->
       </template>
-      <template v-slot:headerTypeDescribe="{ column }">
+      <!-- <template v-slot:headerTypeDescribe="{ column }">
         <span class="is-required">{{ column.label }}</span>
-      </template>
-      <template v-slot:headerType="{ column }">
+      </template>-->
+      <!-- <template v-slot:headerType="{ column }">
         <span class="is-required">{{ column.label }}</span>
-      </template>
+      </template>-->
     </ele-pro-table>
-    <headerTitle
-      title="联系人信息"
-      style="margin-top: 10px"
-      v-if="isPurchaseNeed"
-    ></headerTitle>
+    <headerTitle title="联系人信息" style="margin-top: 10px" v-if="isPurchaseNeed"></headerTitle>
     <ele-pro-table
       :style="{ marginTop: isPurchaseNeed ? 0 : '10px' }"
       ref="table"
@@ -169,23 +319,27 @@
       :toolkit="[]"
       class="el-form-box"
       :need-page="false"
+      @selection-change="handleSelectionChange"
+      v-if="source != '报工信息'"
     >
       <!-- 表头工具栏 -->
-      <template v-slot:toolbar v-if="type != 'view'">
-        <el-button type="primary" @click="addBank">添加</el-button>
+      <template v-slot:toolbar>
+        <el-button type="primary" v-if="tableOperate" @click="addBank">添加</el-button>
+        <el-button type="danger" v-if="type != 'view'" @click="delContact">删除</el-button>
+        <span class="reserve" v-if="type != 'view'">请至少留一条联系人数据</span>
       </template>
       <template v-slot:headerContactName="{ column }">
         <span class="is-required">{{ column.label }}</span>
       </template>
       <template v-slot:action="{ row, $index }">
+        <!-- v-if="type != 'view'" -->
         <el-link
           type="danger"
           :underline="false"
           icon="el-icon-delete"
-          v-if="type != 'view'"
+          v-if="faultOperate(row)"
           @click="handleBankDel(row, $index)"
-          >删除
-        </el-link>
+        >删除</el-link>
       </template>
 
       <template v-slot:contactName="{ row,$index  }">
@@ -200,437 +354,581 @@
           <el-input
             v-model="row.contactName"
             placeholder="请输入"
-            :disabled="type == 'view'"
+            :disabled="change_permission"
             maxlength="50"
           ></el-input>
         </el-form-item>
       </template>
       <template v-slot:contactPhone="{ row }">
-        <el-input
-          v-model="row.contactPhone"
-          placeholder="请输入"
-          :disabled="type == 'view'"
-        ></el-input>
+        <el-input v-model="row.contactPhone" placeholder="请输入" :disabled="change_permission"></el-input>
       </template>
       <template v-slot:post="{ row }">
-        <el-input
-          v-model="row.post"
-          placeholder="请输入"
-          :disabled="type == 'view'"
-        ></el-input>
+        <el-input v-model="row.post" placeholder="请输入" :disabled="change_permission"></el-input>
       </template>
       <template v-slot:telephone="{ row }">
-        <el-input
-          v-model="row.telephone"
-          placeholder="请输入"
-          :disabled="type == 'view'"
-        ></el-input>
+        <el-input v-model="row.telephone" placeholder="请输入" :disabled="change_permission"></el-input>
       </template>
       <template v-slot:email="{ row }">
-        <el-input
-          v-model="row.email"
-          placeholder="请输入"
-          :disabled="type == 'view'"
-        ></el-input>
+        <el-input v-model="row.email" placeholder="请输入" :disabled="change_permission"></el-input>
       </template>
       <template v-slot:wechat="{ row }">
-        <el-input
-          v-model="row.wechat"
-          placeholder="请输入"
-          :disabled="type == 'view'"
-        ></el-input>
+        <el-input v-model="row.wechat" placeholder="请输入" :disabled="change_permission"></el-input>
       </template>
       <template v-slot:deptName="{ row }">
-        <el-input
-          v-model="row.deptName"
-          placeholder="请输入"
-          :disabled="type == 'view'"
-        ></el-input>
+        <el-input v-model="row.deptName" placeholder="请输入" :disabled="change_permission"></el-input>
       </template>
       <template v-slot:remark="{ row }">
-        <el-input
-          v-model="row.remark"
-          placeholder="请输入"
-          :disabled="type == 'view'"
-        ></el-input>
+        <el-input v-model="row.remark" placeholder="请输入" :disabled="change_permission"></el-input>
       </template>
     </ele-pro-table>
     <parentList ref="parentRef" @changeParent="changeParent"></parentList>
-    <invoiceDialog
-      ref="invoiceDialogRef"
-      @changeParent="invoiceChange"
-    ></invoiceDialog>
+    <invoiceDialog ref="invoiceDialogRef" @changeParent="invoiceChange"></invoiceDialog>
   </el-form>
 </template>
 
 <script>
-  import fileMain from '@/components/addDoc/index.vue';
-  import { mapGetters, mapActions } from 'vuex';
-  import { contactDetail } from '@/api/saleManage/contact';
-  import parentList from '@/views/saleManage/contact/components/parentList.vue';
-  import invoiceDialog from './invoiceDialog.vue';
-  export default {
-    components: { fileMain, parentList, invoiceDialog },
-    computed: {
-      ...mapGetters(['getDictValue']),
-      bankColumns() {
-        return [
-          {
-            type: 'index',
-            width: 55,
-            align: 'center'
-          },
-          {
-            label: '姓名',
-            prop: 'contactName',
-            slot: 'contactName',
-            headerSlot: 'headerContactName',
-            align: 'center'
-          },
-          {
-            label: '手机',
-            prop: 'contactPhone',
-            slot: 'contactPhone',
-            align: 'center'
-          },
-          {
-            label: '电话',
-            prop: 'telephone',
-            slot: 'telephone',
-            align: 'center'
-          },
+import dictMixins from '@/mixins/dictMixins';
+import fileMain from '@/components/addDoc/index.vue';
+import { mapGetters, mapActions } from 'vuex';
+import { contactDetail } from '@/api/saleManage/contact';
+import parentList from '@/views/saleManage/contact/components/parentList.vue';
+import invoiceDialog from './invoiceDialog.vue';
+export default {
+  mixins: [dictMixins],
+  components: { fileMain, parentList, invoiceDialog },
+  computed: {
+    ...mapGetters(['getDictValue']),
+    bankColumns() {
+      return [
+        {
+          label: '序号',
+          type: 'index',
+          width: 55,
+          align: 'center'
+        },
+        {
+          width: 45,
+          type: 'selection',
+          columnKey: 'selection',
+          align: 'center',
+          show: this.type != 'view'
+        },
+        {
+          label: '姓名',
+          prop: 'contactName',
+          slot: 'contactName',
+          headerSlot: 'headerContactName',
+          align: 'center'
+        },
+        {
+          label: '手机',
+          prop: 'contactPhone',
+          slot: 'contactPhone',
+          align: 'center'
+        },
+        {
+          label: '电话',
+          prop: 'telephone',
+          slot: 'telephone',
+          align: 'center'
+        },
+
+        {
+          label: '微信号',
+          prop: 'wechat',
+          slot: 'wechat',
+          align: 'center'
+        },
+        {
+          label: '邮箱',
+          prop: 'email',
+          slot: 'email',
+          align: 'center'
+        },
+        {
+          label: '部门',
+          prop: 'deptName',
+          slot: 'deptName',
+          align: 'center'
+        },
+        {
+          label: '职务',
+          prop: 'post',
+          slot: 'post',
+          align: 'center'
+        },
+        {
+          label: '备注',
+          prop: 'remark',
+          slot: 'remark',
+          align: 'center'
+        },
+        {
+          action: 'action',
+          slot: 'action',
+          label: '操作',
+          align: 'center',
+          fixed: 'right',
+          showOverflowTooltip: true
+          // show: this.type != 'view'
+        }
+      ];
+    },
+    columnsDetail() {
+      return [
+        {
+          columnKey: 'index',
+          label: '序号',
+          type: 'index',
+          width: 55,
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        // {
+        //   action: 'select',
+        //   slot: 'select',
+        //   align: 'center',
+        //   label: '选择'
+        // },
+        {
+          width: 45,
+          type: 'expand',
+          columnKey: 'expand',
+          align: 'center',
+          slot: 'expand'
+        },
+        {
+          prop: 'categoryCode',
+          label: '编码',
+          align: 'center',
+          showOverflowTooltip: true
+        },
 
-          {
-            label: '微信号',
-            prop: 'wechat',
-            slot: 'wechat',
-            align: 'center'
-          },
-          {
-            label: '邮箱',
-            prop: 'email',
-            slot: 'email',
-            align: 'center'
-          },
-          {
-            label: '部门',
-            prop: 'deptName',
-            slot: 'deptName',
-            align: 'center'
-          },
-          {
-            label: '职务',
-            prop: 'post',
-            slot: 'post',
-            align: 'center'
-          },
-          {
-            label: '备注',
-            prop: 'remark',
-            slot: 'remark',
-            align: 'center'
-          },
-          {
-            action: 'action',
-            slot: 'action',
-            label: '操作',
-            align: 'center',
-            fixed: 'right',
-            showOverflowTooltip: true,
-            show: this.type != 'view'
+        {
+          prop: 'categoryName',
+          label: '名称',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'categoryModel',
+          label: '型号',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'batchNo',
+          label: '批次号',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'barcodes',
+          label: '发货条码',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'shipmentDate',
+          label: '发货时间',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'guaranteePeriodDeadline',
+          label: '质保有效期',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'warrantyStatus',
+          label: '质保状态',
+          align: 'center',
+          showOverflowTooltip: true,
+          formatter: (_row, _column, cellValue) => {
+            return _row.warrantyStatus == 1 ? '质保期外' : '质保期内';
           }
-        ];
-      },
-      columnsDetail() {
-        return [
-          {
-            columnKey: 'index',
-            label: '序号',
-            type: 'index',
-            width: 55,
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'categoryCode',
-            label: '编码',
-            align: 'center',
-            showOverflowTooltip: true
-          },
+        },
 
-          {
-            prop: 'categoryName',
-            label: '名称',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'categoryModel',
-            label: '型号',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'batchNo',
-            label: '批次号',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'barcodes',
-            label: '发货条码',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'shipmentDate',
-            label: '发货时间',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'guaranteePeriodDeadline',
-            label: '质保有效期',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'warrantyStatus',
-            label: '质保状态',
-            align: 'center',
-            showOverflowTooltip: true,
-            formatter: (_row, _column, cellValue) => {
-              return _row.warrantyStatus == 1 ? '质保期外' : '质保期内';
-            }
-          },
+        {
+          prop: 'measureQuantity',
+          label: '计量数量',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'packageNo',
+          label: '包装编码',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'packingQuantity',
+          label: '包装数量',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'packingUnit',
+          label: '包装单位',
+          align: 'center',
+          showOverflowTooltip: true
+        },
 
-          {
-            prop: 'measureQuantity',
-            label: '计量数量',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'packageNo',
-            label: '包装编码',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'packingQuantity',
-            label: '包装数量',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'packingUnit',
-            label: '包装单位',
-            align: 'center',
-            showOverflowTooltip: true
-          },
+        {
+          prop: 'materielDesignation',
+          label: '物料代号',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'engrave',
+          label: '刻码',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        //   {
+        //     prop: 'useLocation',
+        //     label: '使用地点',
+        //     align: 'center',
+        //     slot: 'useLocation',
+        //     showOverflowTooltip: true,
+        //     width: 200
+        //   },
+        // {
+        //     prop: 'type',
+        //     slot: 'type',
+        //     label: '问题类型',
+        //     align: 'center',
+        //     headerSlot: 'headerType',
+        //     showOverflowTooltip: true,
+        //     width: 120
+        //   },
+        //   {
+        //     prop: 'typeDescribe',
+        //     slot: 'typeDescribe',
+        //     label: '问题描述',
+        //     headerSlot: 'headerTypeDescribe',
+        //     align: 'center',
+        //     showOverflowTooltip: true,
+        //     width: 400
+        //   },
+        //   {
+        //     prop: 'attachments',
+        //     slot: 'attachments',
+        //     label: '附件',
+        //     align: 'center',
+        //     width: 120
+        //   },
+        {
+          columnKey: 'action',
+          label: '操作',
+          width: 150,
+          align: 'center',
+          resizable: false,
+          slot: 'action',
+          // fixed: 'right',
+          showOverflowTooltip: true
+          // show: this.type != 'view'
+        }
+      ];
+    },
+    // 问题描述 ***
+    faultList() {
+      return [
+        {
+          type: 'index',
+          label: '序号',
+          align: 'center',
+          width: 60
+        },
+        {
+          prop: 'type',
+          slot: 'type',
+          label: '故障类型',
+          align: 'center',
+          headerSlot: 'headerType',
+          showOverflowTooltip: true,
+          width: 120
+        },
+        {
+          prop: 'faultPhenomenon',
+          slot: 'faultPhenomenon',
+          headerSlot: 'headerPhenomenon',
+          label: '故障现象',
+          align: 'center',
+          width: 300
+        },
+        {
+          prop: 'faultReason',
+          slot: 'faultReason',
+          headerSlot: 'headerFaultReason',
+          label: '故障原因',
+          align: 'center',
+          width: 400
+        },
+        {
+          prop: 'maintenanceProcess',
+          slot: 'maintenanceProcess',
+          headerSlot: 'headerMaintenance',
+          label: '维修过程',
+          align: 'center',
+          width: 400
+        },
+        {
+          prop: 'attachments',
+          slot: 'attachments',
+          label: '附件',
+          align: 'center',
+          width: 120
+        },
+        {
+          columnKey: 'action',
+          label: '操作',
+          width: 150,
+          align: 'center',
+          resizable: false,
+          slot: 'action',
+          // fixed: 'right',
+          showOverflowTooltip: true
+        }
+      ];
+    },
+    // 需求表格修改权限 ***
+    tableOperate() {
+      let flag = this.type != 'view' || this.state == '可操作';
+      return flag;
+    },
 
-          {
-            prop: 'materielDesignation',
-            label: '物料代号',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'engrave',
-            label: '刻码',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          //   {
-          //     prop: 'useLocation',
-          //     label: '使用地点',
-          //     align: 'center',
-          //     slot: 'useLocation',
-          //     showOverflowTooltip: true,
-          //     width: 200
-          //   },
-          {
-            prop: 'type',
-            slot: 'type',
-            label: '问题类型',
-            align: 'center',
-            headerSlot: 'headerType',
-            showOverflowTooltip: true,
-            width: 120
-          },
-          {
-            prop: 'typeDescribe',
-            slot: 'typeDescribe',
-            label: '问题描述',
-            headerSlot: 'headerTypeDescribe',
-            align: 'center',
-            showOverflowTooltip: true,
-            width: 400
-          },
-          {
-            prop: 'attachments',
-            slot: 'attachments',
-            label: '附件',
-            align: 'center',
-            width: 120
-          },
-          {
-            columnKey: 'action',
-            label: '操作',
-            width: 150,
-            align: 'center',
-            resizable: false,
-            slot: 'action',
-            fixed: 'right',
-            showOverflowTooltip: true,
-            show: this.type != 'view'
-          }
-        ];
-      }
+    // 故障列表删除权限
+    faultOperate() {
+      return (row) => {
+        let flag = (this.state == '可操作' && !row.id) || this.type != 'view';
+        return flag;
+      };
     },
-    props: {
-      type: '',
-      isPurchaseNeed: {
-        default: true,
-        type: Boolean
+
+    // 故障/联系人列表更改权限 ***
+    change_permission() {
+      let flag = this.type === 'view';
+      if (this.source) {
+        return false;
       }
+      return flag;
+    }
+  },
+  props: {
+    type: '',
+    isPurchaseNeed: {
+      default: true,
+      type: Boolean
     },
-    data() {
-      return {
-        tableList: [],
-        typeOptions: [
-          { label: '维修', value: '1' },
-          { label: '保养', value: '2' },
-          { label: '安装', value: '3' }
-        ],
-        form: { contractInfo: {}, tableList: [], contactInfoVOS: [] },
-        rules: {}
-      };
+    // 来源页面 ***
+    source: {
+      default: '',
+      type: String
     },
 
-    created() {},
-    methods: {
-      async init(res) {
-        this.$set(this.form, 'tableList', res.productDetail);
-        this.$set(this.form, 'orderCode', res.orderCode);
-        this.$set(this.form, 'orderId', res.orderId);
-        this.$set(this.form, 'contactInfoVOS', res.contactInfoVOS);
-        if (res.contactAddress) {
-          this.$set(this.form, 'contactAddress', res.contactAddress);
-        }
-        this.contactDetail(res.contactId, 'init');
-      },
-      getValue() {
-        return this.form;
-      },
-      //客户选择
-      handHead() {
-        if (this.type != 'view') {
-          this.$refs.parentRef.open();
+    // 表格数据 更改状态
+    state: {
+      default: '',
+      type: String
+    }
+  },
+  data() {
+    return {
+      expandedRowKeys: [],
+      expandedKeys: [],
+      tableList: [],
+      selection: [],
+      // 日期选择器配置
+      pickerOptions: {
+        disabledDate(time) {
+          // 禁用今天之前的日期
+          return time.getTime() < new Date().setHours(0, 0, 0, 0);
         }
       },
-      changeParent(res) {
-        this.contactDetail(res.id);
+      typeOptions: [
+        { label: '维修', value: '1' },
+        { label: '保养', value: '2' },
+        { label: '安装', value: '3' }
+      ],
+      form: {
+        contractInfo: {},
+        tableList: [],
+        contactInfoVOS: []
       },
-      //客户回调
-      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;
-        }
+      rules: {},
+      radio: null
+    };
+  },
 
-        this.$set(this.form, 'contractInfo', base);
+  created() {},
+  methods: {
+    async init(res) {
+      this.$set(this.form, 'tableList', res.productDetail);
+      this.$set(this.form, 'orderCode', res.orderCode);
+      this.$set(this.form, 'orderId', res.orderId);
+      this.$set(this.form, 'contactInfoVOS', res.contactInfoVOS);
+      this.$set(this.form, 'name', res.name);
+      let faultLevel = res.faultLevel ? String(res.faultLevel) : '';
+      this.$set(this.form, 'faultLevel', faultLevel);
+      this.$set(this.form, 'code', res.code);
+      this.$set(this.form, 'expectedTime', res.expectedTime);
+      if (res.contactAddress) {
+        this.$set(this.form, 'contactAddress', res.contactAddress);
+      }
+      this.contactDetail(res.contactId, 'init');
+    },
+    getValue() {
+      return this.form;
+    },
+    //客户选择
+    handHead() {
+      if (this.type != 'view') {
+        this.$refs.parentRef.open();
+      }
+    },
+    changeParent(res) {
+      this.contactDetail(res.id);
+    },
+    //客户回调
+    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;
+      }
 
-        if (type != 'init') {
-          this.$set(this.form, 'contactAddress', addressName);
-          this.$set(
-            this.form,
-            'contactInfoVOS',
-            linkList.map((item) => {
-              item['contactName'] = item.linkName;
-              item['contactPhone'] = item.mobilePhone;
-              item['telephone'] = item.phone;
-              return item;
-            })
-          );
-        }
+      this.$set(this.form, 'contractInfo', base);
 
-        // this.contractInfo = base;
-      },
-      //发货单选择
-      invoiceDialogOpen() {
-        if (!this.form?.contractInfo?.id) {
-          this.$message.warning('请先选择客户!');
-          return;
-        }
-        if (this.type != 'view') {
-          this.$refs.invoiceDialogRef.open(this.form.contractInfo.id);
-        }
-      },
-      //发货单回调
-      invoiceChange(data) {
-        console.log(data, 'data');
-        this.$set(this.form, 'orderCode', data.orderCode);
-        this.$set(this.form, 'orderId', data.orderId);
-        this.$set(this.form, 'tableList', data.tableList);
-      },
-      addBank() {
-        this.form.contactInfoVOS.push({
-          contactName: '',
-          contactPhone: '',
-          remark: ''
-        });
-      },
-      handleBankDel(row, index) {
-        this.form.contactInfoVOS.splice(index, 1);
-      },
-      del(row, index) {
-        this.form.tableList.splice(index, 1);
-      },
+      if (type != 'init') {
+        this.$set(this.form, 'contactAddress', addressName);
+        this.$set(
+          this.form,
+          'contactInfoVOS',
+          linkList.map((item) => {
+            item['contactName'] = item.linkName;
+            item['contactPhone'] = item.mobilePhone;
+            item['telephone'] = item.phone;
+            return item;
+          })
+        );
+      }
+      // this.contractInfo = base;
+    },
+    //发货单选择
+    invoiceDialogOpen() {
+      if (!this.form?.contractInfo?.id) {
+        this.$message.warning('请先选择客户!');
+        return;
+      }
+      if (this.type != 'view') {
+        this.$refs.invoiceDialogRef.open(this.form.contractInfo.id);
+      }
+    },
+    //发货单回调
+    invoiceChange(data) {
+      console.log(data, 'data 执行了没');
+      this.$set(this.form, 'orderCode', data.orderCode);
+      this.$set(this.form, 'orderId', data.orderId);
+      this.$set(this.form, 'tableList', data.tableList);
+      // 单选赋值 ***
+      // if (data.tableList && data.tableList.length > 0) {
+      //   this.radio = data.tableList[0].id;
+      //   this.radio = 0;
+      // }
+    },
+    addBank() {
+      this.form.contactInfoVOS.push({
+        contactName: '',
+        contactPhone: '',
+        remark: ''
+      });
+    },
+    // *** 添加问题
+    addProblem(row) {
+      if (!row.faultDetails) this.$set(row, 'faultDetails', []);
+      let len = row.faultDetails.length;
+      this.$set(row.faultDetails, len, {
+        maintenanceProcess: '',
+        type: '',
+        faultPhenomenon: ''
+        // demandDetailId: row.id
+      });
+      // this.expandedRowKeys = this.$refs.tableRef3.getData()?.map((item) => item.id).filter(id => id != null);
+      // this.expandedRowKeys.push(row.id)
+      // console.log(this.expandedRowKeys,'this.expandedRowKeys')
+    },
+    // *** 删除问题
+    delSon(row, idx) {
+      row.faultDetails.splice(idx, 1);
+      this.$forceUpdate();
+    },
+    //
+    handleSelectionChange(rows) {
+      this.selection = rows;
+    },
+    // *** 删除联系人
+    delContact() {
+      this.form.contactInfoVOS = this.form.contactInfoVOS.filter(
+        (row) => !this.selection.includes(row)
+      );
+    },
+    handleBankDel(row, index) {
+      this.form.contactInfoVOS.splice(index, 1);
+    },
+    del(row, index) {
+      this.form.tableList.splice(index, 1);
+    },
 
-      getValidate() {
-        return new Promise((resolve, reject) => {
-          this.$refs.form.validate((valid, obj) => {
-            if (obj) {
-              let messages = Object.keys(obj).map((key) => obj[key][0]);
-              if (messages.length > 0) {
-                this.$message.warning(messages[0].message);
-              }
+    getValidate() {
+      return new Promise((resolve, reject) => {
+        this.$refs.form.validate((valid, obj) => {
+          if (obj) {
+            let messages = Object.keys(obj).map((key) => obj[key][0]);
+            if (messages.length > 0) {
+              this.$message.warning(messages[0].message);
             }
-            if (!valid) {
-              reject(false);
-            } else {
-              resolve(true);
-            }
-          });
+          }
+          if (!valid) {
+            reject(false);
+          } else {
+            resolve(true);
+          }
         });
-      },
-      catch() {
-        this.form = {
-          tableList: [],
-          contractInfo: {},
-          contactInfoVOS: [],
-          orderCode: '',
-          orderId: ''
-        };
-      }
+      });
+    },
+    catch() {
+      this.form = {
+        tableList: [],
+        contractInfo: {},
+        contactInfoVOS: [],
+        orderCode: '',
+        orderId: ''
+      };
     }
-  };
+  }
+};
 </script>
 <style lang="scss" scoped>
-  :deep(.el-table__body .el-form-item__content) {
-    margin-left: 0px !important;
-  }
-  :deep(.el-table__body .el-form-item) {
-    margin-bottom: 0px !important;
-  }
+:deep(.el-table__body .el-form-item__content) {
+  margin-left: 0px !important;
+}
+:deep(.el-table__body .el-form-item) {
+  margin-bottom: 0px !important;
+}
+
+.reserve {
+  margin-left: 16px;
+  color: #e6a23c;
+}
 </style>

+ 341 - 329
src/views/salesServiceManagement/components/sparePartsList.vue

@@ -2,13 +2,7 @@
   <div class="ele-body">
     <!-- <el-card shadow="never" v-loading="loading"> -->
     <!-- 数据表格 -->
-    <el-form
-      ref="form"
-      :model="form"
-      :rules="[]"
-      label-width="100px"
-      class="create-form"
-    >
+    <el-form ref="form" :model="form" :rules="[]" label-width="100px" class="create-form">
       <ele-pro-table
         ref="tableRef2"
         :columns="columnsDetail"
@@ -18,14 +12,12 @@
         :need-page="false"
         height="300px"
       >
-        <template v-slot:toolbar v-if="type != 'view'">
-          <el-button type="primary" @click="addBank">添加</el-button>
+        <template v-slot:toolbar>
+          <el-button v-if="type != 'view' && source != '报工信息'" type="primary" @click="addBank">添加</el-button>
+          <span class="total_price">总价: {{ totalPrice }} (元)</span>
         </template>
         <template v-slot:typeId="scope">
-          <el-form-item
-            style="margin-bottom: 20px"
-            :prop="'tableList.' + scope.$index + '.typeId'"
-          >
+          <el-form-item style="margin-bottom: 20px" :prop="'tableList.' + scope.$index + '.typeId'">
             <el-select
               v-model="scope.row.typeId"
               placeholder="请选择"
@@ -43,10 +35,7 @@
           </el-form-item>
         </template>
         <template v-slot:code="scope">
-          <el-form-item
-            style="margin-bottom: 20px"
-            :prop="'tableList.' + scope.$index + '.code'"
-          >
+          <el-form-item style="margin-bottom: 20px" :prop="'tableList.' + scope.$index + '.code'">
             <el-input
               v-if="scope.row.typeId != 2"
               :disabled="type == 'view'"
@@ -81,8 +70,7 @@
               type="primary"
               style="margin-left: 4px"
               @click.native="addEquipment(row, scope.$index)"
-              >选择
-            </el-button>
+            >选择</el-button>
           </el-form-item>
         </template>
         <template v-slot:categoryModel="scope">
@@ -95,9 +83,11 @@
               :disabled="type == 'view'"
               v-model="scope.row.categoryModel"
             ></el-input>
-            <span v-if="scope.row.typeId == 2">{{
+            <span v-if="scope.row.typeId == 2">
+              {{
               scope.row.categoryModel
-            }}</span>
+              }}
+            </span>
           </el-form-item>
         </template>
         <template v-slot:specification="scope">
@@ -110,9 +100,11 @@
               :disabled="type == 'view'"
               v-model="scope.row.specification"
             ></el-input>
-            <span v-if="scope.row.typeId == 2">{{
+            <span v-if="scope.row.typeId == 2">
+              {{
               scope.row.specification
-            }}</span>
+              }}
+            </span>
           </el-form-item>
         </template>
         <template v-slot:content="scope">
@@ -120,10 +112,7 @@
             style="margin-bottom: 20px"
             :prop="'tableList.' + scope.$index + '.content'"
           >
-            <el-input
-              v-model="scope.row.content"
-              :disabled="type == 'view'"
-            ></el-input>
+            <el-input v-model="scope.row.content" :disabled="type == 'view'"></el-input>
           </el-form-item>
         </template>
         <template v-slot:totalCount="scope">
@@ -149,9 +138,11 @@
               v-model="scope.row.measureUnit"
               :disabled="type == 'view'"
             ></el-input>
-            <span v-if="scope.row.typeId == 2">{{
+            <span v-if="scope.row.typeId == 2">
+              {{
               scope.row.measureUnit
-            }}</span>
+              }}
+            </span>
           </el-form-item>
         </template>
         <template v-slot:singlePrice="scope">
@@ -193,10 +184,9 @@
             type="danger"
             :underline="false"
             icon="el-icon-delete"
-            v-if="type != 'view' && row.isApply != 1"
+            v-if="type != 'view' && row.isApply != 1 && source != '报工信息'"
             @click="del(row, $index)"
-            >删除
-          </el-link>
+          >删除</el-link>
         </template>
         <template v-slot:headerName="{ column }">
           <span class="is-required">{{ column.label }}</span>
@@ -208,8 +198,7 @@
       :assetType="6"
       @choose="confirmChoose"
       :isAll="false"
-    >
-    </AssetsDialog>
+    ></AssetsDialog>
     <product-list
       ref="productListRef"
       classType="1"
@@ -223,322 +212,345 @@
 </template>
 
 <script>
-  import {
-    getWarehouseOutStock,
-    getIdWarehouseList
-  } from '@/api/saleManage/saleorder';
+import {
+  getWarehouseOutStock,
+  getIdWarehouseList
+} from '@/api/saleManage/saleorder';
 
-  import AssetsDialog from './AssetsDialog.vue';
-  import productList from '@/BIZComponents/product-list.vue';
+import AssetsDialog from './AssetsDialog.vue';
+import productList from '@/BIZComponents/product-list.vue';
 
-  export default {
-    components: {
-      //   applyForSpare,
-      AssetsDialog,
-      productList
-    },
-    props: {
-      type: ''
+export default {
+  components: {
+    //   applyForSpare,
+    AssetsDialog,
+    productList
+  },
+  props: {
+    type: '',
+    // 数据来源
+    source: {
+      default: '',
+      type: String
     },
-    data() {
-      return {
-        loading: false,
-        form: {
-          tableList: []
+    // 表格权限操作 状态
+    state: {
+      default: '',
+      type: String
+    }
+  },
+  data() {
+    return {
+      loading: false,
+      form: {
+        tableList: []
+      },
+      totalPrice: 0,
+      typeIdList: [
+        {
+          label: '工时',
+          value: '1'
+        },
+        {
+          label: '零配件',
+          value: '2'
+        },
+        {
+          label: '差旅费',
+          value: '3'
+        }
+      ]
+    };
+  },
+  computed: {
+    columnsDetail() {
+      return [
+        {
+          columnKey: 'index',
+          label: '序号',
+          type: 'index',
+          width: 55,
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'typeId',
+          label: '项目',
+          align: 'center',
+          width: 120,
+          slot: 'typeId',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'code',
+          label: '编码',
+          align: 'center',
+          slot: 'code',
+          minWidth: 150,
+          showOverflowTooltip: true
         },
-        typeIdList: [
-          {
-            label: '工时',
-            value: '1'
-          },
-          {
-            label: '零配件',
-            value: '2'
-          },
-          {
-            label: '差旅费',
-            value: '3'
-          }
-        ]
-      };
-    },
-    computed: {
-      columnsDetail() {
-        return [
-          {
-            columnKey: 'index',
-            label: '序号',
-            type: 'index',
-            width: 55,
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'typeId',
-            label: '项目',
-            align: 'center',
-            width: 120,
-            slot: 'typeId',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'code',
-            label: '编码',
-            align: 'center',
-            slot: 'code',
-            minWidth: 150,
-            showOverflowTooltip: true
-          },
 
-          {
-            prop: 'name',
-            label: '名称',
-            align: 'center',
-            minWidth: 250,
-            slot: 'name',
-            showOverflowTooltip: true,
-            headerSlot: 'headerName'
-          },
-          {
-            prop: 'categoryModel',
-            label: '型号',
-            width: 150,
-            align: 'center',
-            slot: 'categoryModel',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'specification',
-            width: 150,
-            label: '规格',
-            slot: 'specification',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'content',
-            minWidth: 300,
-            slot: 'content',
-            label: '详细内容',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'warehouseId',
-            minWidth: 170,
-            slot: 'warehouseId',
-            label: '仓库',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'warehouseNum',
-            minWidth: 100,
-            label: '库存',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'totalCount',
-            slot: 'totalCount',
-            width: 100,
-            label: '数量',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'measureUnit',
-            width: 120,
-            slot: 'measureUnit',
-            label: '单位',
-            align: 'center',
-            showOverflowTooltip: true
-          },
+        {
+          prop: 'name',
+          label: '名称',
+          align: 'center',
+          minWidth: 250,
+          slot: 'name',
+          showOverflowTooltip: true,
+          headerSlot: 'headerName'
+        },
+        {
+          prop: 'categoryModel',
+          label: '型号',
+          width: 150,
+          align: 'center',
+          slot: 'categoryModel',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'specification',
+          width: 150,
+          label: '规格',
+          slot: 'specification',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'content',
+          minWidth: 300,
+          slot: 'content',
+          label: '详细内容',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'warehouseId',
+          minWidth: 170,
+          slot: 'warehouseId',
+          label: '仓库',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'warehouseNum',
+          minWidth: 100,
+          label: '库存',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'totalCount',
+          slot: 'totalCount',
+          width: 100,
+          label: '数量',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'measureUnit',
+          width: 120,
+          slot: 'measureUnit',
+          label: '单位',
+          align: 'center',
+          showOverflowTooltip: true
+        },
 
-          {
-            prop: 'singlePrice',
-            slot: 'singlePrice',
-            width: 120,
-            label: '单价',
-            align: 'center',
-            showOverflowTooltip: true
-          },
+        {
+          prop: 'singlePrice',
+          slot: 'singlePrice',
+          width: 120,
+          label: '单价(元)',
+          align: 'center',
+          showOverflowTooltip: true
+        },
 
-          {
-            prop: 'settlementPrice',
-            width: 80,
-            label: '合计',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            columnKey: 'action',
-            label: '操作',
-            width: 150,
-            align: 'center',
-            resizable: false,
-            slot: 'action',
-            fixed: 'right',
-            showOverflowTooltip: true,
-            show: this.type == 'edit'
-          }
-        ];
-      }
+        {
+          prop: 'settlementPrice',
+          width: 80,
+          label: '合计(元)',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          columnKey: 'action',
+          label: '操作',
+          width: 150,
+          align: 'center',
+          resizable: false,
+          slot: 'action',
+          fixed: 'right',
+          showOverflowTooltip: true,
+          show: this.type == 'edit'
+        }
+      ];
+    }
+  },
+  watch: {},
+  created() {},
+  methods: {
+    init(row) {},
+    typeIdChange(row, index) {
+      this.$set(this.form.tableList, index, {
+        typeId: row.typeId,
+        code: '',
+        name: '',
+        categoryModel: '',
+        specification: '',
+        content: '',
+        totalCount: 1,
+        measureUnit: '',
+        singlePrice: '',
+        settlementPrice: ''
+      });
     },
-    watch: {},
-    created() {},
-    methods: {
-      init(row) {},
-      typeIdChange(row, index) {
-        this.$set(this.form.tableList, index, {
-          typeId: row.typeId,
-          code: '',
-          name: '',
-          categoryModel: '',
-          specification: '',
-          content: '',
-          totalCount: 1,
-          measureUnit: '',
-          singlePrice: '',
-          settlementPrice: ''
-        });
-      },
-      getValidate() {
-        return new Promise((resolve, reject) => {
-          this.$refs.form.validate((valid, obj) => {
-            if (obj) {
-              let messages = Object.keys(obj).map((key) => obj[key][0]);
-              if (messages.length > 0) {
-                this.$message.warning(messages[0].message);
-              }
-            }
-            if (!valid) {
-              reject(false);
-            } else {
-              resolve(true);
+    getValidate() {
+      return new Promise((resolve, reject) => {
+        this.$refs.form.validate((valid, obj) => {
+          if (obj) {
+            let messages = Object.keys(obj).map((key) => obj[key][0]);
+            if (messages.length > 0) {
+              this.$message.warning(messages[0].message);
             }
-          });
-        });
-      },
-      addBank() {
-        this.form.tableList.push({
-          typeId: '2',
-          code: '',
-          name: '',
-          categoryModel: '',
-          specification: '',
-          content: '',
-          totalCount: 1,
-          measureUnit: '',
-          singlePrice: '',
-          settlementPrice: ''
+          }
+          if (!valid) {
+            reject(false);
+          } else {
+            resolve(true);
+          }
         });
-      },
-      addEquipment(row, index) {
-        this.currentIndex = index;
-        this.$refs.productListRef.open('', index);
-      },
-      getTableValue() {
-        return this.form.tableList;
-      },
-      setTableValue(val) {
-        this.$set(this.form, 'tableList', val);
-        this.form.tableList.forEach(async (item, index) => {
-          if (item.typeId == 2) {
+      });
+    },
+    addBank() {
+      this.form.tableList.push({
+        typeId: '2',
+        code: '',
+        name: '',
+        categoryModel: '',
+        specification: '',
+        content: '',
+        totalCount: 1,
+        measureUnit: '',
+        singlePrice: '',
+        settlementPrice: ''
+      });
+    },
+    addEquipment(row, index) {
+      this.currentIndex = index;
+      this.$refs.productListRef.open('', index);
+    },
+    getTableValue() {
+      return this.form.tableList;
+    },
+    setTableValue(val) {
+      this.$set(this.form, 'tableList', val);
+      this.form.tableList.forEach(async (item, index) => {
+        if (item.typeId == 2) {
+          this.$set(
+            this.form.tableList[index],
+            'warehouseList',
+            await getIdWarehouseList({
+              categoryId: item.categoryId
+            })
+          );
+          if (item.warehouseId) {
             this.$set(
               this.form.tableList[index],
-              'warehouseList',
-              await getIdWarehouseList({
-                categoryId: item.categoryId
+              'warehouseNum',
+              await getWarehouseOutStock({
+                warehouseId: item.warehouseId,
+                code: item.code
               })
             );
-            if (item.warehouseId) {
-              this.$set(
-                this.form.tableList[index],
-                'warehouseNum',
-                await getWarehouseOutStock({
-                  warehouseId: item.warehouseId,
-                  code: item.code
-                })
-              );
-            }
           }
-        });
-      },
-      totalCountChange(index) {
-        let row = this.form.tableList[index];
-        if (row.totalCount && row.singlePrice) {
-          row.settlementPrice = row.totalCount * row.singlePrice;
         }
-        this.$set(
-          this.form.tableList[index],
-          'settlementPrice',
-          row.settlementPrice || 0
-        );
-      },
-      del(row, index) {
-        this.form.tableList.splice(index, 1);
-      },
-      async confirmChoose(data) {
-        this.$set(this.form.tableList, this.currentIndex, data[0]);
-        this.$set(
-          this.form.tableList[this.currentIndex],
-          'categoryModel',
-          data[0].modelType
-        );
-        this.$set(
-          this.form.tableList[this.currentIndex],
-          'categoryId',
-          data[0].id
-        );
-        this.$set(
-          this.form.tableList[this.currentIndex],
-          'measureUnit',
-          data[0].measuringUnit
-        );
+      });
+      // ***
+      this.calculatePrice();
+    },
+    totalCountChange(index) {
+      let row = this.form.tableList[index];
+      if (row.totalCount && row.singlePrice) {
+        row.settlementPrice = row.totalCount * row.singlePrice;
+      }
+      this.$set(
+        this.form.tableList[index],
+        'settlementPrice',
+        row.settlementPrice || 0
+      );
+      this.calculatePrice();
+    },
+    // 计算汇总价格 ***
+    calculatePrice() {
+      let totlal = 0;
+      this.form.tableList.map((el) => (totlal += el.settlementPrice));
+      this.totalPrice = totlal;
+    },
+    del(row, index) {
+      this.form.tableList.splice(index, 1);
+    },
+    async confirmChoose(data) {
+      this.$set(this.form.tableList, this.currentIndex, data[0]);
+      this.$set(
+        this.form.tableList[this.currentIndex],
+        'categoryModel',
+        data[0].modelType
+      );
+      this.$set(
+        this.form.tableList[this.currentIndex],
+        'categoryId',
+        data[0].id
+      );
+      this.$set(
+        this.form.tableList[this.currentIndex],
+        'measureUnit',
+        data[0].measuringUnit
+      );
 
-        this.$set(
+      this.$set(
+        this.form.tableList[this.currentIndex],
+        'warehouseList',
+        await getIdWarehouseList({
+          categoryId: data[0].id
+        })
+      );
+      if (this.form.tableList[this.currentIndex]?.warehouseList?.length) {
+        this.warehouseChange(
+          this.form.tableList[this.currentIndex].warehouseList[0],
           this.form.tableList[this.currentIndex],
-          'warehouseList',
-          await getIdWarehouseList({
-            categoryId: data[0].id
-          })
-        );
-        if (this.form.tableList[this.currentIndex]?.warehouseList?.length) {
-          this.warehouseChange(
-            this.form.tableList[this.currentIndex].warehouseList[0],
-            this.form.tableList[this.currentIndex],
-            this.currentIndex
-          );
-        }
-
-        this.$set(this.form.tableList[this.currentIndex], 'typeId', '2');
-        this.$forceUpdate();
-      },
-      async warehouseChange(item, row, index) {
-        this.$set(
-          this.form.tableList[index],
-          'warehouseName',
-          item.warehouseName
-        );
-        this.$set(this.form.tableList[index], 'warehouseId', item.warehouseId);
-        this.$set(
-          this.form.tableList[index],
-          'warehouseNum',
-          await getWarehouseOutStock({
-            warehouseId: item.warehouseId,
-            code: row.code
-          })
+          this.currentIndex
         );
       }
+
+      this.$set(this.form.tableList[this.currentIndex], 'typeId', '2');
+      this.$forceUpdate();
+    },
+    async warehouseChange(item, row, index) {
+      this.$set(
+        this.form.tableList[index],
+        'warehouseName',
+        item.warehouseName
+      );
+      this.$set(this.form.tableList[index], 'warehouseId', item.warehouseId);
+      this.$set(
+        this.form.tableList[index],
+        'warehouseNum',
+        await getWarehouseOutStock({
+          warehouseId: item.warehouseId,
+          code: row.code
+        })
+      );
     }
-  };
+  }
+};
 </script>
 <style lang="scss" scoped>
-  :deep(.el-table__body .el-form-item__content) {
-    margin-left: 0px !important;
-  }
-  :deep(.el-table__body .el-form-item) {
-    margin-bottom: 0px !important;
-  }
+:deep(.el-table__body .el-form-item__content) {
+  margin-left: 0px !important;
+}
+:deep(.el-table__body .el-form-item) {
+  margin-bottom: 0px !important;
+}
+.total_price {
+  margin-left: 24px;
+}
 </style>

+ 133 - 111
src/views/salesServiceManagement/demandList/components/addDialog.vue

@@ -8,144 +8,166 @@
     width="85%"
     :maxable="true"
     append-to-body
-    :fullscreen="fullscreen"
     @close="handleClose"
   >
+    <!-- :fullscreen="fullscreen" -->
     <info ref="infoRef" :type="type"></info>
     <div slot="footer" class="footer">
-      <el-button type="primary" @click="submitAdd" v-if="type != 'view'"
-        >保存</el-button
-      >
+      <el-button type="primary" @click="submitAdd" v-if="type != 'view'">保存</el-button>
       <el-button @click="handleClose">返回</el-button>
     </div>
   </ele-modal>
 </template>
 
 <script>
-  import { mapGetters, mapActions } from 'vuex';
+import { mapGetters, mapActions } from 'vuex';
 
-  import modalTitle from '@/BIZComponents/modalTitle.vue';
-  import customerDialog from '@/views/financialManage/components/customerListDialog.vue';
+import modalTitle from '@/BIZComponents/modalTitle.vue';
+import customerDialog from '@/views/financialManage/components/customerListDialog.vue';
 
-  import {
-    saveSalesDemand,
-    updateSalesDemand,
-    getSalesDemandById
-  } from '@/api/salesServiceManagement/index';
+import {
+  saveSalesDemand,
+  updateSalesDemand,
+  getSalesDemandById
+} from '@/api/salesServiceManagement/index';
 
-  import fileMain from '@/components/addDoc/index.vue';
-  import info from '@/views/salesServiceManagement/components/info.vue';
+import fileMain from '@/components/addDoc/index.vue';
+import info from '@/views/salesServiceManagement/components/info.vue';
 
-  export default {
-    components: {
-      modalTitle,
-      customerDialog,
-      fileMain,
-      info
-    },
-    watch: {},
-    computed: {
-      ...mapGetters(['getDictValue'])
-    },
-    data() {
-      return {
-        title: '新增',
-        addRepairNotesDialog: false,
-        type: 'add',
-        form: {}
-      };
+export default {
+  components: {
+    modalTitle,
+    customerDialog,
+    fileMain,
+    info
+  },
+  watch: {},
+  computed: {
+    ...mapGetters(['getDictValue'])
+  },
+  data() {
+    return {
+      title: '新增',
+      addRepairNotesDialog: false,
+      type: 'add',
+      form: {}
+    };
+  },
+  created() {},
+  methods: {
+    // 初始化数据(父组件调用)
+    init(row, type) {
+      this.addRepairNotesDialog = true;
+      this.type = type;
+      this.title = type == 'add' ? '新增' : type == 'view' ? '详情' : '修改';
+      if (row?.id) {
+        this.getDetail(row.id);
+      } else {
+      }
     },
-    created() {},
-    methods: {
-      // 初始化数据(父组件调用)
-      init(row, type) {
-        this.addRepairNotesDialog = true;
-        this.type = type;
-        this.title = type == 'add' ? '新增' : type == 'view' ? '详情' : '修改';
-        if (row?.id) {
-          this.getDetail(row.id);
-        } else {
-        }
-      },
-      async getDetail(id) {
-        const res = await getSalesDemandById(id);
-        this.$nextTick(() => {
-          this.$refs.infoRef.init(res);
-        });
+    async getDetail(id) {
+      const res = await getSalesDemandById(id);
+      console.log(res,'res')
+      this.$nextTick(() => {
+        this.$refs.infoRef.init(res);
+      });
 
-        this.form = res;
-      },
+      this.form = res;
+    },
 
-      handleClose() {
-        this.addRepairNotesDialog = false;
-        this.form = {};
-        this.$refs.infoRef.catch();
-      },
-      async submitAdd() {
-        let data = this.$refs.infoRef.getValue();
-        if (!data.contactInfoVOS?.length) {
-          this.$message.warning('联系人信息至少有1条');
-          return;
+    handleClose() {
+      this.addRepairNotesDialog = false;
+      this.form = {};
+      this.$refs.infoRef.catch();
+    },
+    // 标准时间函数 ***
+    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');
         }
-        try {
-          let valid = await this.$refs.infoRef.getValidate();
-          let pData = {
-            ...this.form,
-            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
-          };
-          let requestname =
-            this.title === '新增' ? saveSalesDemand : updateSalesDemand;
-          const res = await requestname(pData);
-          if (res) {
-            this.$message.success('操作成功!');
-            this.$emit('refresh');
-            this.handleClose();
-          }
-        } catch (error) {}
+        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; // 转换失败时返回原始字符串
+      }
+    },
+    async submitAdd() {
+      let data = this.$refs.infoRef.getValue();
+      if (!data.contactInfoVOS?.length) {
+        this.$message.warning('联系人信息至少有1条');
+        return;
       }
+      try {
+        let valid = await this.$refs.infoRef.getValidate();
+        let pData = {
+          ...this.form,
+          name: data.name,
+          faultLevel: data.faultLevel,
+          expectedTime: this.formatDate(data.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
+        };
+        let requestname =
+          this.title === '新增' ? saveSalesDemand : updateSalesDemand;
+        console.log(pData, 'pData');
+        const res = await requestname(pData);
+        if (res) {
+          this.$message.success('操作成功!');
+          this.$emit('refresh');
+          this.handleClose();
+        }
+      } catch (error) {}
     }
-  };
+  }
+};
 </script>
 
 <style lang="scss" scoped>
-  .dialog_top {
-    margin-bottom: 10px;
-    display: flex;
-    align-items: center;
-
-    span {
-      margin-left: 50px;
-    }
+.dialog_top {
+  margin-bottom: 10px;
+  display: flex;
+  align-items: center;
 
-    .name {
-      font-weight: 800;
-      color: #40a9ff;
-    }
+  span {
+    margin-left: 50px;
   }
 
-  ::v-deep .el-row {
-    display: flex;
-    flex-wrap: wrap;
+  .name {
+    font-weight: 800;
+    color: #40a9ff;
   }
+}
 
-  .btns {
-    text-align: right;
-    // margin: 10px 0;
-  }
+::v-deep .el-row {
+  display: flex;
+  flex-wrap: wrap;
+}
 
-  .main_container {
-    width: 100%;
-    display: flex;
-    justify-content: space-between;
-  }
+.btns {
+  text-align: right;
+  // margin: 10px 0;
+}
+
+.main_container {
+  width: 100%;
+  display: flex;
+  justify-content: space-between;
+}
 </style>

+ 6 - 0
src/views/salesServiceManagement/demandList/index.vue

@@ -184,6 +184,12 @@
             align: 'center',
             showOverflowTooltip: true
           },
+          {
+            prop: 'faultLevel',
+            label: '故障等级',
+            align: 'center',
+            showOverflowTooltip: true
+          },
           {
             prop: 'createUserName',
             label: '创建人',

+ 210 - 189
src/views/salesServiceManagement/toDoList/components/addOrUpdateDialog.vue

@@ -9,25 +9,20 @@
     @close="handleClose"
   >
     <header-title title="计划基本信息"></header-title>
-    <el-form
-      ref="addFormRef"
-      :model="addForm"
-      :rules="addFormRules"
-      label-width="120px"
-    >
+    <el-form ref="addFormRef" :model="addForm" :rules="addFormRules" label-width="120px">
       <el-row>
-        <el-col :span="8">
+        <el-col :span="6">
           <el-form-item label="编码" prop="code">
             <el-input
               v-model="addForm.code"
               size="small"
               placeholder="请输入"
-              :disabled="type == 'view'"
               disabled
             ></el-input>
+            <!-- :disabled="type == 'view'" -->
           </el-form-item>
         </el-col>
-        <el-col :span="8">
+        <el-col :span="6">
           <el-form-item
             label="名称"
             prop="name"
@@ -45,7 +40,7 @@
             ></el-input>
           </el-form-item>
         </el-col>
-        <el-col :span="8">
+        <el-col :span="6">
           <el-form-item label="自动派单" prop="isSyncBill">
             <el-select
               v-model="addForm.isSyncBill"
@@ -58,9 +53,7 @@
             </el-select>
           </el-form-item>
         </el-col>
-      </el-row>
-      <el-row>
-        <el-col :span="8">
+        <el-col :span="6">
           <el-form-item label="预计售后时长" prop="duration">
             <div style="display: flex">
               <el-input
@@ -75,7 +68,7 @@
                   <el-select
                     v-model="addForm.durationUnit"
                     size="small"
-                    style="width: 80px"
+                    style="width: 120px"
                     :disabled="type == 'view'"
                   >
                     <el-option :value="'1'" label="分钟"></el-option>
@@ -87,7 +80,9 @@
             </div>
           </el-form-item>
         </el-col>
-        <el-col :span="8">
+      </el-row>
+      <el-row>
+        <el-col :span="6">
           <el-form-item
             label="部门"
             prop="executeGroupId"
@@ -104,7 +99,7 @@
             />
           </el-form-item>
         </el-col>
-        <el-col :span="8">
+        <el-col :span="6">
           <el-form-item
             label="执行人"
             prop="executeUserId"
@@ -131,20 +126,17 @@
             </el-select>
           </el-form-item>
         </el-col>
-      </el-row>
-      <el-row>
-        <el-col :span="8">
+        <el-col :span="6">
           <el-form-item label="紧急程度" prop="urgent">
             <DictSelection
               dictName="紧急程度"
               clearable
               v-model="addForm.urgent"
               :disabled="type == 'view'"
-            >
-            </DictSelection>
+            ></DictSelection>
           </el-form-item>
         </el-col>
-        <el-col :span="16">
+        <el-col :span="6">
           <el-form-item label="备注" prop="remark">
             <el-input
               type="textarea"
@@ -159,202 +151,231 @@
         </el-col>
       </el-row>
     </el-form>
-    <info ref="infoRef" type="view" :isPurchaseNeed="false"></info>
-
+    <!-- ***改 -->
+    <div class="ele-body-custom">
+      <el-tabs v-model="activeName" style="width: 100%" type="border-card">
+        <el-tab-pane label="需求信息" name="需求信息">
+          <info ref="infoRef" v-if="type == 'view'" type="view" :isPurchaseNeed="false"></info>
+          <info ref="infoRef" v-else source="售后计划" type="view" state="可操作" :isPurchaseNeed="false"></info>
+        </el-tab-pane>
+        <el-tab-pane label="方案" name="方案">
+          <spareParts ref="sparePartsRef" :type="type"></spareParts>
+        </el-tab-pane>
+      </el-tabs>
+    </div>
+    <!-- <info ref="infoRef" type="view" :isPurchaseNeed="false"></info>
     <header-title title="方案"></header-title>
-    <spareParts ref="sparePartsRef" :type="type"></spareParts>
+    <spareParts ref="sparePartsRef" :type="type"></spareParts>-->
 
     <template v-slot:footer>
       <el-button @click="handleClose">取消</el-button>
-      <el-button type="primary" @click="save" v-if="type != 'view'">
-        保存</el-button
-      >
-      <el-button type="primary" @click="save" v-if="isDispatch">
-        确认派单</el-button
-      >
+      <el-button type="primary" @click="save" v-if="type != 'view'">保存</el-button>
+      <el-button type="primary" @click="save" v-if="isDispatch">确认派单</el-button>
     </template>
   </ele-modal>
 </template>
 
 <script>
-  import {
-    getSalesPlanById,
-    updateSalesPlan,
-    dispatchOrders
-  } from '@/api/salesServiceManagement/index';
-  import { contactDetail } from '@/api/saleManage/contact';
-  import { getUserPage } from '@/api/system/organization';
+import {
+  getSalesPlanById,
+  updateSalesPlan,
+  dispatchOrders
+} from '@/api/salesServiceManagement/index';
+import { contactDetail } from '@/api/saleManage/contact';
+import { getUserPage } from '@/api/system/organization';
 
-  import deptSelect from '@/components/CommomSelect/dept-select.vue';
-  import fileMain from '@/components/addDoc/index.vue';
-  import spareParts from '@/views/salesServiceManagement/components/sparePartsList.vue';
-  import info from '@/views/salesServiceManagement/components/info.vue';
+import deptSelect from '@/components/CommomSelect/dept-select.vue';
+import fileMain from '@/components/addDoc/index.vue';
+import spareParts from '@/views/salesServiceManagement/components/sparePartsList.vue';
+import info from '@/views/salesServiceManagement/components/info.vue';
 
-  import { mapGetters } from 'vuex';
-  let def = {
-    name: '',
-    isSyncBill: 1,
-    duration: null,
-    executeGroupId: '',
-    executeGroupName: '',
-    executeUserId: '',
-    executeUserName: '',
-    urgent: null,
-    remark: '',
-    durationUnit: '2'
-  };
-  export default {
-    components: {
-      deptSelect,
-      fileMain,
-      spareParts,
-      info
-    },
+import { mapGetters } from 'vuex';
+let def = {
+  name: '',
+  isSyncBill: 1,
+  duration: null,
+  executeGroupId: '',
+  executeGroupName: '',
+  executeUserId: '',
+  executeUserName: '',
+  urgent: null,
+  remark: '',
+  durationUnit: '2'
+};
+export default {
+  components: {
+    deptSelect,
+    fileMain,
+    spareParts,
+    info
+  },
+
+  props: {
 
-    props: {},
-    data() {
-      return {
-        addForm: {
-          ...def
-        },
-        executorList: [], // 业务人员列表
-        // 表单验证规则
-        addFormRules: {},
-        visible: false,
+  },
+  data() {
+    return {
+      activeName: '需求信息',
+      addForm: {
+        ...def
+      },
+      executorList: [], // 业务人员列表
+      // 表单验证规则
+      addFormRules: {},
+      visible: false,
 
-        statusList: [
-          { label: '草稿', value: -1 },
-          { label: '失效', value: 0 },
-          { label: '生效', value: 1 }
-        ],
+      statusList: [
+        { label: '草稿', value: -1 },
+        { label: '失效', value: 0 },
+        { label: '生效', value: 1 }
+      ],
 
-        // 提交状态
-        loading: false,
-        type: 'add',
-        title: '',
-        isDispatch: false,
-        detailList: []
-      };
+      // 提交状态
+      loading: false,
+      type: 'add',
+      title: '',
+      isDispatch: false,
+      detailList: []
+    };
+  },
+  computed: {
+    ...mapGetters(['getDictValue']),
+    // 是否开启响应式布局
+    styleResponsive() {
+      return this.$store.state.theme.styleResponsive;
+    }
+  },
+  watch: {},
+  methods: {
+    handleClose() {
+      this.addForm = { ...def };
+      this.visible = false;
     },
-    computed: {
-      ...mapGetters(['getDictValue']),
-      // 是否开启响应式布局
-      styleResponsive() {
-        return this.$store.state.theme.styleResponsive;
+    // 初始化
+    async init(row, type, isDispatch) {
+      this.type = type;
+      this.title = isDispatch ? '派单' : type == 'view' ? '详情' : '修改';
+      this.isDispatch = isDispatch;
+      if (row) {
+        this.visible = true;
+        this.getInfo(row.id);
+        if (row.executeGroupId) {
+          this.getUserList({ groupId: row.executeGroupId });
+        }
       }
     },
-    watch: {},
-    methods: {
-      handleClose() {
-        this.addForm = { ...def };
-        this.visible = false;
-      },
-      // 初始化
-      async init(row, type, isDispatch) {
-        this.type = type;
-        this.title = isDispatch ? '派单' : type == 'view' ? '详情' : '修改';
-        this.isDispatch = isDispatch;
-        if (row) {
-          this.visible = true;
-          this.getInfo(row.id);
-          if (row.executeGroupId) {
-            this.getUserList({ groupId: row.executeGroupId });
-          }
-        }
-      },
 
-      formDataDurationTime(value) {
-        if (value > 0) {
-          this.addForm.duration = value.replace(/^[0]+/, '');
-        } else {
-          this.addForm.duration = 0;
+    formDataDurationTime(value) {
+      if (value > 0) {
+        this.addForm.duration = value.replace(/^[0]+/, '');
+      } else {
+        this.addForm.duration = 0;
+      }
+    },
+    //选择部门(搜索)
+    searchDeptNodeClick(info, data) {
+      if (info) {
+        // 根据部门获取人员
+        this.addForm.executeGroupName = data.name;
+        const params = { groupId: info };
+        this.getUserList(params);
+      } else {
+        this.addForm.executeGroupId = null;
+      }
+    },
+    // 获取审核人列表、巡点检人员
+    async getUserList(params) {
+      try {
+        let data = { pageNum: 1, size: -1 };
+        // 如果传了参数就是获取巡点检人员数据
+        if (params) {
+          data = Object.assign(data, params);
         }
-      },
-      //选择部门(搜索)
-      searchDeptNodeClick(info, data) {
-        if (info) {
-          // 根据部门获取人员
-          this.addForm.executeGroupName = data.name;
-          const params = { groupId: info };
-          this.getUserList(params);
-        } else {
-          this.addForm.executeGroupId = null;
+        const res = await getUserPage(data);
+        if (params) {
+          this.executorList = res.list;
         }
-      },
-      // 获取审核人列表、巡点检人员
-      async getUserList(params) {
-        try {
-          let data = { pageNum: 1, size: -1 };
-          // 如果传了参数就是获取巡点检人员数据
-          if (params) {
-            data = Object.assign(data, params);
-          }
-          const res = await getUserPage(data);
-          if (params) {
-            this.executorList = res.list;
+      } catch (error) {}
+    },
+    changeUser(val) {
+      this.executorList.map((item) => {
+        if (item.id == val) {
+          this.addForm.executeUserName = item.name;
+        }
+      });
+    },
+    async save() {
+      try {
+        let valid = await this.$refs.infoRef.getValidate();
+        let data = this.$refs.infoRef.getValue();
+        await this.$refs.sparePartsRef.getValidate();
+        this.addForm.costListVOS = this.$refs.sparePartsRef.getTableValue();
+        this.$refs.addFormRef.validate(async (valid, obj) => {
+          if (obj) {
+            let messages = Object.keys(obj).map((key) => obj[key][0]);
+            if (messages.length > 0) {
+              this.$message.warning(messages[0].message);
+            }
           }
-        } catch (error) {}
-      },
-      changeUser(val) {
-        this.executorList.map((item) => {
-          if (item.id == val) {
-            this.addForm.executeUserName = item.name;
+          if (valid) {
+            let requestName = this.isDispatch
+              ? dispatchOrders
+              : updateSalesPlan;
+            // *** 新增参数
+            let obj = this.infoData(data);
+            this.addForm.salesDemandUpdatePO = obj;
+            const res = await requestName(this.addForm);
+            if (!res) return;
+            this.$message.success('保存成功');
+            this.visible = false;
+            this.$emit('reload');
           }
         });
-      },
-      async save() {
-        try {
-          await this.$refs.sparePartsRef.getValidate();
-          this.addForm.costListVOS = this.$refs.sparePartsRef.getTableValue();
-          this.$refs.addFormRef.validate(async (valid, obj) => {
-            if (obj) {
-              let messages = Object.keys(obj).map((key) => obj[key][0]);
-              if (messages.length > 0) {
-                this.$message.warning(messages[0].message);
-              }
-            }
-            if (valid) {
-              let requestName = this.isDispatch
-                ? dispatchOrders
-                : updateSalesPlan;
-              const res = await requestName(this.addForm);
-              if (!res) return;
-              this.$message.success('保存成功');
-              this.visible = false;
-              this.$emit('reload');
-            }
-          });
-        } catch (error) {}
-      },
-
-      async getInfo(id) {
-        const res = await getSalesPlanById(id);
-        if (!res) return;
-        this.addForm = res;
-        this.$nextTick(() => {
-          this.$refs.infoRef.init(res.afterSalesDemandVO);
-          this.$refs.sparePartsRef.setTableValue(res?.costListVOS || []);
-        });
-      }
+      } catch (error) {}
+    },
+    // *** 需求信息参数
+    infoData(data) {
+      let obj = JSON.parse(JSON.stringify(data));
+      obj.productDetail = obj.tableList;
+      delete obj.tableList;
+      obj.id = this.addForm.afterSalesDemandVO.id;
+      obj.productDetail.map((el)=> delete el.produceTime)
+      return obj;
+    },
+    async getInfo(id) {
+      const res = await getSalesPlanById(id);
+      if (!res) return;
+      this.addForm = res;
+      this.$nextTick(() => {
+        this.$refs.infoRef.init(res.afterSalesDemandVO);
+        this.$refs.sparePartsRef.setTableValue(res?.costListVOS || []);
+      });
     }
-  };
+  }
+};
 </script>
 
 <style lang="scss" scoped>
-  .marginBto {
-    margin-bottom: 10px;
+.marginBto {
+  margin-bottom: 10px;
 
-    span {
-      margin-left: 50px;
-    }
+  span {
+    margin-left: 50px;
+  }
 
-    .name {
-      font-weight: 800;
-      color: #40a9ff;
-    }
+  .name {
+    font-weight: 800;
+    color: #40a9ff;
   }
-  :deep(.el-input__suffix .el-input__inner) {
-    border: none;
-    background: none;
+}
+:deep(.el-input__suffix .el-input__inner) {
+  border: none;
+  background: none;
+}
+
+.ele-body-custom {
+  :deep(.divider) {
+    display: none;
   }
+}
 </style>

+ 377 - 171
src/views/salesServiceManagement/workOrder/components/declarationDialog.vue

@@ -10,8 +10,43 @@
     :maxable="true"
   >
     <el-form ref="form" :model="addForm" label-width="120px">
-      <el-row :gutter="24">
+      <el-row>
+        <el-col :span="8">
+          <el-form-item label="工单编码">
+            <el-input v-model="salesForm.code" size="small" placeholder="请输入" disabled></el-input>
+          </el-form-item>
+        </el-col>
+        <!-- 用计划名称 -->
+        <el-col :span="8">
+          <el-form-item label="名称">
+            <el-input v-model="salesForm.code" size="small" placeholder="请输入" disabled></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="接收人">
+            <el-input v-model="salesForm.code" size="small" placeholder="请输入" disabled></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row>
+        <el-col :span="8">
+          <el-form-item label="接收时间">
+            <el-input v-model="salesForm.code" size="small" placeholder="请输入" disabled></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="派单人">
+            <el-input v-model="salesForm.code" size="small" placeholder="请输入" disabled></el-input>
+          </el-form-item>
+        </el-col>
         <el-col :span="8">
+          <el-form-item label="派单时间">
+            <el-input v-model="salesForm.code" size="small" placeholder="请输入" disabled></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row :gutter="24">
+        <!-- <el-col :span="8">
           <el-form-item
             label="实际起始时间"
             prop="time"
@@ -31,11 +66,9 @@
               end-placeholder="实际结束日期"
               :disabled="type == 'view'"
               @change="getTime"
-            >
-            </el-date-picker>
+            ></el-date-picker>
           </el-form-item>
         </el-col>
-
         <el-col :span="8">
           <el-form-item label="实际售后时长" prop="inFactDuration">
             <el-input v-model="addForm.inFactDuration" :disabled="true">
@@ -45,10 +78,7 @@
         </el-col>
         <el-col :span="8">
           <el-form-item label="附件" prop="attachments">
-            <fileMain
-              v-model="addForm.attachments"
-              :type="type == 'view' ? 'view' : 'add'"
-            ></fileMain>
+            <fileMain v-model="addForm.attachments" :type="type == 'view' ? 'view' : 'add'"></fileMain>
           </el-form-item>
         </el-col>
         <el-col :span="8">
@@ -58,8 +88,7 @@
               placeholder="请输入内容"
               v-model="addForm.faultPhenomenon"
               :disabled="type == 'view'"
-            >
-            </el-input>
+            ></el-input>
           </el-form-item>
         </el-col>
         <el-col :span="8">
@@ -69,8 +98,7 @@
               placeholder="请输入内容"
               v-model="addForm.faultReason"
               :disabled="type == 'view'"
-            >
-            </el-input>
+            ></el-input>
           </el-form-item>
         </el-col>
         <el-col :span="8">
@@ -80,211 +108,389 @@
               placeholder="请输入内容"
               v-model="addForm.maintenanceProcess"
               :disabled="type == 'view'"
-            >
-            </el-input>
+            ></el-input>
           </el-form-item>
-        </el-col>
-        <el-col :span="24">
+        </el-col>-->
+        <!-- ***改 -->
+        <div class="ele-body-custom">
+          <el-tabs v-model="activeName" style="width: 100%" type="border-card">
+            <el-tab-pane label="需求信息" name="需求信息">
+              <el-col :span="24" class="ele-body-customA">
+                <info ref="infoRef2" v-if="infoDisabled" type="view" :isPurchaseNeed="false"></info>
+                <info
+                  ref="infoRef2"
+                  v-else
+                  source="售后计划"
+                  state="可操作"
+                  type="view"
+                  :isPurchaseNeed="false"
+                ></info>
+              </el-col>
+            </el-tab-pane>
+            <el-tab-pane label="计划信息" name="计划信息">
+              <planDialog ref="plan"></planDialog>
+            </el-tab-pane>
+            <el-tab-pane label="方案" name="方案">
+              <el-col :span="24">
+                <spareParts ref="sparePartsRef2" :type="type == 'edit' ? 'edit' : 'view'"></spareParts>
+                <!--  source="报工信息" -->
+              </el-col>
+            </el-tab-pane>
+            <!-- v-if="type == 'report'" 标记 -->
+            <el-tab-pane v-if="infoShow" label="报工信息" name="报工信息" class="job_infor">
+              <el-col :span="12">
+                <el-form-item
+                  label="实际起始时间"
+                  prop="time"
+                  :rules="{
+                    required: true,
+                    message: '实际起始时间',
+                    trigger: 'change'
+                  }"
+                >
+                  <el-date-picker
+                    style="width: 100%"
+                    v-model="addForm.time"
+                    type="datetimerange"
+                    value-format="yyyy-MM-dd HH:mm:ss"
+                    range-separator="至"
+                    start-placeholder="实际开始日期"
+                    end-placeholder="实际结束日期"
+                    :disabled="type == 'view'"
+                    @change="getTime"
+                  ></el-date-picker>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="实际售后时长" prop="inFactDuration" class="after_sales">
+                  <el-input v-model="hours" :disabled="true">
+                    <template slot="append">小时</template>
+                  </el-input>
+                  <el-input v-model="minutes" :disabled="true">
+                    <template slot="append">分钟</template>
+                  </el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="24" class="ele-body-customA">
+                <info ref="infoRef" source="报工信息"  type="view" :isPurchaseNeed="false"></info>
+              </el-col>
+              <el-col :span="24">
+                <spareParts
+                  ref="sparePartsRef"
+                  source="报工信息"
+                  :type="type == 'edit' ? 'edit' : 'view'"
+                ></spareParts>
+              </el-col>
+            </el-tab-pane>
+          </el-tabs>
+        </div>
+        <!-- <el-col :span="24">
           <info ref="infoRef" type="view" :isPurchaseNeed="false"></info>
         </el-col>
         <el-col :span="24">
           <header-title title="方案" style="margin-top: 10px"></header-title>
-          <spareParts
-            ref="sparePartsRef"
-            :type="type == 'edit' ? 'edit' : 'view'"
-          ></spareParts>
-        </el-col>
-        <el-col :span="8" v-if="type=='view'">
+          <spareParts ref="sparePartsRef" :type="type == 'edit' ? 'edit' : 'view'"></spareParts>
+        </el-col>-->
+        <!-- <el-col :span="8" v-if="type=='view'">
           <el-form-item label="报工时间" prop="acceptTime">
-            <el-input
-              v-model="addForm.acceptTime"
-              :disabled="true"
-            >
-            </el-input>
+            <el-input v-model="addForm.acceptTime" :disabled="true"></el-input>
           </el-form-item>
         </el-col>
-        <el-col :span="8"  v-if="type=='view'">
+        <el-col :span="8" v-if="type=='view'">
           <el-form-item label="报工人" prop="executeUserName">
-            <el-input
-              v-model="addForm.executeUserName"
-              :disabled="true"
-            >
-            </el-input>
+            <el-input v-model="addForm.executeUserName" :disabled="true"></el-input>
           </el-form-item>
         </el-col>
-        <el-col :span="8"  v-if="type=='view'">
+        <el-col :span="8" v-if="type=='view'">
           <el-form-item label="验收人" prop="accepterUserName">
-            <el-input
-              v-model="addForm.accepterUserName"
-              :disabled="true"
-            >
-            </el-input>
+            <el-input v-model="addForm.accepterUserName" :disabled="true"></el-input>
           </el-form-item>
         </el-col>
-        <el-col :span="8"  v-if="type=='view'">
+        <el-col :span="8" v-if="type=='view'">
           <el-form-item label="验收时间" prop="accepterTime">
-            <el-input
-              v-model="addForm.accepterTime"
-              :disabled="true"
-            >
-            </el-input>
+            <el-input v-model="addForm.accepterTime" :disabled="true"></el-input>
           </el-form-item>
         </el-col>
-        <el-col :span="8"  v-if="type=='view'">
+        <el-col :span="8" v-if="type=='view'">
           <el-form-item label="验收意见" prop="accepterRemark">
-            <el-input
-              v-model="addForm.accepterRemark"
-              :disabled="true"
-            type="textarea"
-            >
-            </el-input>
+            <el-input v-model="addForm.accepterRemark" :disabled="true" type="textarea"></el-input>
           </el-form-item>
-        </el-col>
+        </el-col>-->
       </el-row>
     </el-form>
 
     <div slot="footer" class="footer">
-      <el-button type="primary" @click="submitAdd" v-if="type == 'report'"
-        >提交</el-button
-      >
-      <el-button type="primary" @click="submitAdd" v-if="type == 'edit'"
-        >保存</el-button
-      >
+      <el-button
+        type="primary"
+        @click="submitAdd"
+        v-if="type == 'report'"
+      >{{ type == 'edit'? '提交' : '报工'}}</el-button>
+
+      <el-button type="primary" @click="saveAdd" v-if="type == 'report'">保存</el-button>
       <el-button @click="handleClose">取消</el-button>
     </div>
   </ele-modal>
 </template>
 
 <script>
-  import fileMain from '@/components/addDoc/index.vue';
-  import {
-    reportWorkingSalesWorkOrder,
-    updateScheme,
-    getSalesWorkOrderById
-  } from '@/api/salesServiceManagement/index';
-  import spareParts from '@/views/salesServiceManagement/components/sparePartsList.vue';
-  import info from '@/views/salesServiceManagement/components/info.vue';
-  export default {
-    props: {},
-    components: {
-      fileMain,
-      spareParts,
-      info
-    },
-    watch: {},
-    computed: {},
-    data() {
-      return {
-        title: '',
-        visibleDialog: false,
-        addForm: {
-          id: '',
-          time: [],
-          attachments: [],
-          reason: ''
-        },
-        row: {},
-        type: ''
-      };
+import fileMain from '@/components/addDoc/index.vue';
+import {
+  reportWorkingSalesWorkOrder,
+  updateScheme,
+  getSalesWorkOrderById
+} from '@/api/salesServiceManagement/index';
+import spareParts from '@/views/salesServiceManagement/components/sparePartsList.vue';
+import info from '@/views/salesServiceManagement/components/info.vue';
+import planDialog from './planDialog.vue';
+export default {
+  props: {},
+  components: {
+    fileMain,
+    spareParts,
+    info,
+    planDialog
+  },
+  watch: {
+    'addForm.inFactDuration': {
+      handler(newVal, oldVal) {
+        this.calculateTimeDifference(newVal);
+      },
+      deep: false,
+      immediate: true
+    }
+  },
+  computed: {
+    infoDisabled() {
+      let flag = this.type == 'view' || this.type == 'report';
+      return flag;
     },
-    created() {},
-    methods: {
-      open(row, type) {
-        this.visibleDialog = true;
-        this.type = type;
-        this.title = type == 'edit' ? '修改' : type == 'view' ? '详情' : '报工';
-        this.getDetail(row);
+    infoShow(){
+      console.log(this.addForm.orderStatus,'00000')
+      let flag = this.type == 'report' || this.addForm.orderStatus == 3;
+      return flag
+    }
+  },
+  data() {
+    return {
+      activeName: '需求信息',
+      title: '',
+      visibleDialog: false,
+      addForm: {
+        id: '',
+        time: [],
+        attachments: [],
+        reason: ''
       },
-      async getDetail(row) {
-        const res = await getSalesWorkOrderById(row.id);
-        this.addForm = res;
-        if (this.addForm.acceptTime) {
-          this.$set(this.addForm, 'time', [
-            this.addForm.acceptTime,
-            this.addForm.finishTime
-          ]);
-        }
-        this.$nextTick(() => {
+      row: {},
+      type: '',
+      hours: 0,
+      minutes: 0,
+      salesForm: {}
+    };
+  },
+  created() {},
+  methods: {
+    open(row, type) {
+      this.visibleDialog = true;
+      this.type = type;
+      this.title = type == 'edit' ? '修改' : type == 'view' ? '详情' : '报工';
+      if (type == 'report') {
+        this.activeName = '报工信息';
+      } else {
+        this.activeName = '需求信息';
+      }
+      this.getDetail(row);
+    },
+    async getDetail(row) {
+      const res = await getSalesWorkOrderById(row.id);
+      this.addForm = res;
+      if (this.addForm.acceptTime) {
+        this.$set(this.addForm, 'time', [
+          this.addForm.acceptTime,
+          this.addForm.finishTime
+        ]);
+      }
+      this.$nextTick(() => {
+        // this.$refs.infoRef.init(res.afterSalesDemandVO);
+        // this.$refs.sparePartsRef.setTableValue(res?.costListVOS || []);
+        // *** 报工信息的
+        if (this.infoShow) {
           this.$refs.infoRef.init(res.afterSalesDemandVO);
           this.$refs.sparePartsRef.setTableValue(res?.costListVOS || []);
-        });
-      },
-      async submitAdd() {
-        this.$refs.form.validate(async (valid) => {
-          if (valid) {
-            let data = {
-              acceptTime: this.addForm.time?.[0],
-              finishTime: this.addForm.time?.[1],
-              attachments: this.addForm.attachments,
-              maintenanceProcess: this.addForm.maintenanceProcess,
-              faultPhenomenon: this.addForm.faultPhenomenon,
-              faultReason: this.addForm.faultReason,
-              inFactDuration: this.addForm.inFactDuration,
-              id: this.addForm.id,
-              costListVOS: this.$refs.sparePartsRef.getTableValue()
-            };
-            let api =
-              this.type == 'edit' ? updateScheme : reportWorkingSalesWorkOrder;
-            await api(data).then((res) => {
-              if (!res) return;
-              this.$message.success('操作成功');
-              this.visibleDialog = false;
-              this.$emit('reload');
-            });
-          } else {
-            return false;
-          }
-        });
-      },
-      getTime() {
-        if (this.addForm.time?.length) {
-          this.$set(
-            this.addForm,
-            'inFactDuration',
-            parseInt(
-              (new Date(this.addForm.time[1]).getTime() -
-                new Date(this.addForm.time[0]).getTime()) /
-                60000
-            )
-          );
+          this.$refs.infoRef2.init(res.afterSalesDemandVO);
+          this.$refs.sparePartsRef2.setTableValue(res?.costListVOS || []);
+        } else {
+          this.$refs.infoRef2.init(res.afterSalesDemandVO);
+          this.$refs.sparePartsRef2.setTableValue(res?.costListVOS || []);
         }
-      },
-      handleClose() {
-        this.visibleDialog = false;
+        this.$refs.plan.init(res.afterSalesPlanVO);
+        // afterSalesPlanVO
+      });
+    },
+    // 提交
+    async submitAdd() {
+      // *** 更改
+      let info = this.type == 'edit' ? 'infoRef2' : 'infoRef';
+      let spare = this.type == 'edit' ? 'sparePartsRef2' : 'sparePartsRef';
+      let validInfo = await this.$refs[info].getValidate();
+      let validSpare = await this.$refs[spare].getValidate();
+      let dataA = this.$refs[info].getValue();
+      let obj = this.infoData(dataA);
+      this.finalSubmit(spare, this.type, obj);
+    },
+    // *** 需求信息参数
+    infoData(data) {
+      let obj = JSON.parse(JSON.stringify(data));
+      obj.productDetail = obj.tableList;
+      delete obj.tableList;
+      obj.id = this.addForm.afterSalesDemandVO.id;
+      obj.productDetail.map((el) => delete el.produceTime);
+      return obj;
+    },
+    // 最后提交
+    finalSubmit(spare, type, obj) {
+      this.$refs.form.validate(async (valid) => {
+        if (valid) {
+          let data = {
+            acceptTime: this.addForm.time?.[0],
+            finishTime: this.addForm.time?.[1],
+            attachments: this.addForm.attachments,
+            maintenanceProcess: this.addForm.maintenanceProcess,
+            faultPhenomenon: this.addForm.faultPhenomenon,
+            faultReason: this.addForm.faultReason,
+            inFactDuration: this.addForm.inFactDuration,
+            id: this.addForm.id,
+            costListVOS: this.$refs[spare].getTableValue(),
+            // costListVOS: this.$refs.sparePartsRef.getTableValue()
+            salesDemandUpdatePO: obj
+          };
+          // let api = this.type == 'edit' ? updateScheme : reportWorkingSalesWorkOrder;
+          let api = type == 'edit' ? updateScheme : reportWorkingSalesWorkOrder;
+          await api(data).then((res) => {
+            if (!res) return;
+            this.$message.success('操作成功');
+            this.visibleDialog = false;
+            this.$emit('reload');
+          });
+        } else {
+          return false;
+        }
+      });
+    },
+
+    // 保存
+    async saveAdd() {
+      let dataA = this.$refs.infoRef2.getValue();
+      let obj = this.infoData(dataA);
+      let data = {
+        acceptTime: this.addForm.time?.[0],
+        finishTime: this.addForm.time?.[1],
+        attachments: this.addForm.attachments,
+        maintenanceProcess: this.addForm.maintenanceProcess,
+        faultPhenomenon: this.addForm.faultPhenomenon,
+        faultReason: this.addForm.faultReason,
+        inFactDuration: this.addForm.inFactDuration,
+        id: this.addForm.id,
+        costListVOS: this.$refs.sparePartsRef2.getTableValue(),
+        salesDemandUpdatePO: obj
+      };
+      await updateScheme(data).then((res)=>{
+        if (!res) return;
+          this.$message.success('操作成功');
+          this.visibleDialog = false;
+          this.$emit('reload');
+      })
+    },
+
+    calculateTimeDifference(totalMinutes) {
+      if (!totalMinutes) {
+        this.hours = 0;
+        this.minutes = 0;
+        return;
       }
+      const hours = Math.floor(totalMinutes / 60);
+      const minutes = totalMinutes % 60;
+      this.hours = hours;
+      this.minutes = minutes;
+    },
+    getTime() {
+      if (this.addForm.time?.length) {
+        this.$set(
+          this.addForm,
+          'inFactDuration',
+          parseInt(
+            (new Date(this.addForm.time[1]).getTime() -
+              new Date(this.addForm.time[0]).getTime()) /
+              60000
+          )
+        );
+      }
+    },
+    handleClose() {
+      this.visibleDialog = false;
     }
-  };
+  }
+};
 </script>
 
 <style lang="scss" scoped>
-  .dialog_top {
-    margin-bottom: 10px;
-    display: flex;
-    align-items: center;
+.dialog_top {
+  margin-bottom: 10px;
+  display: flex;
+  align-items: center;
 
-    span {
-      margin-left: 50px;
-    }
+  span {
+    margin-left: 50px;
+  }
 
-    .name {
-      font-weight: 800;
-      color: #40a9ff;
-    }
+  .name {
+    font-weight: 800;
+    color: #40a9ff;
   }
+}
+
+::v-deep .el-row {
+  display: flex;
+  flex-wrap: wrap;
+}
 
-  ::v-deep .el-row {
-    display: flex;
-    flex-wrap: wrap;
+.btns {
+  text-align: right;
+  // margin: 10px 0;
+}
+
+.main_container {
+  width: 100%;
+  display: flex;
+  justify-content: space-between;
+}
+
+.ele-body-custom {
+  width: 100%;
+  margin-bottom: 24px;
+  // :deep(.divider){
+  //   display: none;
+  // }
+}
+
+.ele-body-customA {
+  :deep(.divider) {
+    display: none;
   }
+}
 
-  .btns {
-    text-align: right;
-    // margin: 10px 0;
+.after_sales {
+  :deep(.el-input--medium) {
+    width: 45%;
+  }
+  :deep(.el-input--medium:nth-child(1)) {
+    margin-right: 8%;
   }
+}
 
-  .main_container {
-    width: 100%;
-    display: flex;
-    justify-content: space-between;
+.job_infor {
+  :deep(.ele-body) {
+    padding: 15px 0;
   }
+}
 </style>

+ 98 - 0
src/views/salesServiceManagement/workOrder/components/planDialog.vue

@@ -0,0 +1,98 @@
+<template>
+  <el-form label-width="100px" class="create-form">
+    <el-row>
+      <el-col :span="6">
+        <el-form-item label="编码">
+          <el-input v-model="dataForm.code" size="small" placeholder="请输入" disabled></el-input>
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="名称">
+          <el-input v-model="dataForm.name" size="small" placeholder="请输入" disabled></el-input>
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="自动派单">
+          <el-select v-model="dataForm.isSyncBill" size="small" style="width: 100%" disabled>
+            <el-option :value="1" label="是"></el-option>
+            <el-option :value="0" label="否"></el-option>
+          </el-select>
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="预计售后时长" prop="duration">
+          <div style="display: flex">
+            <el-input
+              type="number"
+              v-model="dataForm.duration"
+              size="small"
+              placeholder="请输入"
+              disabled
+            >
+              <template #suffix>
+                <el-select
+                  v-model="dataForm.durationUnit"
+                  size="small"
+                  style="width: 120px"
+                  disabled
+                >
+                  <el-option :value="'1'" label="分钟"></el-option>
+                  <el-option :value="'2'" label="小时"></el-option>
+                  <el-option :value="'3'" label="天"></el-option>
+                </el-select>
+              </template>
+            </el-input>
+          </div>
+        </el-form-item>
+      </el-col>
+    </el-row>
+    <el-row>
+      <el-col :span="6">
+        <el-form-item label="部门">
+          <el-input v-model="dataForm.code" size="small" placeholder="请输入" disabled></el-input>
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="执行人">
+          <el-input v-model="dataForm.code" size="small" placeholder="请输入" disabled></el-input>
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="紧急程度">
+          <DictSelection dictName="紧急程度" clearable v-model="dataForm.urgent" disabled></DictSelection>
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="备注">
+          <el-input
+            type="textarea"
+            resize="none"
+            v-model="dataForm.remark"
+            :rows="2"
+            placeholder="请详细说明"
+            size="small"
+            disabled
+          ></el-input>
+        </el-form-item>
+      </el-col>
+    </el-row>
+  </el-form>
+</template>
+
+<script>
+export default {
+  data() {
+    return {
+      dataForm: {}
+    };
+  },
+  methods:{
+    async init(data){
+        this.dataForm = data;
+    }
+  }
+};
+</script>
+
+<style>
+</style>