Explorar o código

销售合同页面

cz hai 1 ano
pai
achega
65c97bd6c0

+ 130 - 41
src/components/byForm/index.vue

@@ -7,7 +7,8 @@
       :rules="rules"
       :labelPosition="formOption.labelPosition || 'top'"
       ref="byForm"
-      :disabled="formOption.disabled || false">
+      :disabled="formOption.disabled || false"
+    >
       <template v-for="i in formConfig" :key="i.model">
         <div v-if="i.type == 'title'" class="form-title">
           {{ i.title }}
@@ -15,7 +16,7 @@
         <el-form-item
           :label="i.label"
           :prop="i.prop"
-          v-if="i.isShow || i.isShow == undefined && i.type"
+          v-if="i.isShow || (i.isShow == undefined && i.type)"
           :style="
             i.type == 'title'
               ? 'width:100%'
@@ -25,12 +26,25 @@
               ? 'width:' + formOption.itemWidth + '%'
               : '100%'
           "
-          :class="i.type == 'json' ? (i.isHide ? 'by-form-json dn' : 'by-form-json') : i.isHide ? 'dn' : ''">
+          :class="
+            i.type == 'json'
+              ? i.isHide
+                ? 'by-form-json dn'
+                : 'by-form-json'
+              : i.isHide
+              ? 'dn'
+              : ''
+          "
+        >
           <template #label>
-            <el-popover placement="top"  trigger="hover" :width="i.tipWidth"  v-if="i.isTip">
+            <el-popover
+              placement="top"
+              trigger="hover"
+              :width="i.tipWidth"
+              v-if="i.isTip"
+            >
               <template #reference>
-                <span 
-                  style="color:red">
+                <span style="color: red">
                   {{ i.label }}
                 </span>
               </template>
@@ -50,7 +64,8 @@
             :min="i.min"
             :maxlength="i.maxlength"
             :readonly="i.readonly ? i.readonly : false"
-            :style="i.style" />
+            :style="i.style"
+          />
           <el-input
             v-if="i.type == 'selectInput'"
             v-model="formData[i.prop]"
@@ -63,7 +78,8 @@
             :min="i.min"
             :maxlength="i.maxlength"
             :readonly="i.readonly ? i.readonly : false"
-            :clearable="i.clearable ? i.clearable : false">
+            :clearable="i.clearable ? i.clearable : false"
+          >
             <template #prepend>
               <el-select
                 v-model="formData[i.selectProp]"
@@ -71,8 +87,15 @@
                 @change="(e) => commonsEmit(e, i)"
                 :disabled="i.disabled ? i.disabled : false"
                 :readonly="i.readonly ? i.readonly : false"
-                style="width: 80px">
-                <el-option :label="j.title || j.name || j.label" :value="j.id || j.value" v-for="j in i.data" :key="j.id"> </el-option>
+                style="width: 80px"
+              >
+                <el-option
+                  :label="j.title || j.name || j.label"
+                  :value="j.id || j.value"
+                  v-for="j in i.data"
+                  :key="j.id"
+                >
+                </el-option>
               </el-select>
             </template>
           </el-input>
@@ -86,8 +109,15 @@
             :clearable="i.clearable ? i.clearable : false"
             :filterable="i.filterable ? true : false"
             :style="i.style"
-            :readonly="i.readonly ? i.readonly : false">
-            <el-option :label="j.title || j.name || j.label" :value="j.id || j.value" v-for="j in i.data" :key="j.id"> </el-option>
+            :readonly="i.readonly ? i.readonly : false"
+          >
+            <el-option
+              :label="j.title || j.name || j.label"
+              :value="j.id || j.value"
+              v-for="j in i.data"
+              :key="j.id"
+            >
+            </el-option>
           </el-select>
           <el-tree-select
             v-model="formData[i.prop]"
@@ -103,7 +133,8 @@
             :placeholder="i.placeholder || $t('common.pleaseSelect')"
             :disabled="i.disabled ? i.disabled : false"
             check-strictly
-            :style="i.style" />
+            :style="i.style"
+          />
           <el-date-picker
             v-model="formData[i.prop]"
             :readonly="i.readonly ? i.readonly : false"
@@ -113,18 +144,27 @@
             @change="(e) => commonsEmit(e, i)"
             :disabled="i.disabled ? i.disabled : false"
             :format="i.format ? i.format : dateFormatInit(i.itemType)"
-            :value-format="i.format ? i.format : dateFormatInit(i.itemType)" :style="i.style" />
+            :value-format="i.format ? i.format : dateFormatInit(i.itemType)"
+            :style="i.style"
+          />
           <el-switch
             :disabled="i.disabled ? i.disabled : false"
             v-else-if="i.type == 'switch'"
             :readonly="i.readonly ? i.readonly : false"
-            v-model="formData[i.prop]" />
+            v-model="formData[i.prop]"
+          />
           <el-checkbox-group
             v-else-if="i.type == 'checkbox'"
             v-model="formData[i.prop]"
             :readonly="i.readonly ? i.readonly : false"
-            :disabled="i.disabled ? i.disabled : false">
-            <el-checkbox v-for="j in i.data" :key="j.id || j.value" :label="j.id || j.value" name="type">
+            :disabled="i.disabled ? i.disabled : false"
+          >
+            <el-checkbox
+              v-for="j in i.data"
+              :key="j.id || j.value"
+              :label="j.id || j.value"
+              name="type"
+            >
               {{ j.name || j.label }}
             </el-checkbox>
           </el-checkbox-group>
@@ -133,8 +173,15 @@
             v-model="formData[i.prop]"
             @change="(e) => commonsEmit(e, i)"
             :readonly="i.readonly ? i.readonly : false"
-            :disabled="i.disabled ? i.disabled : false">
-            <el-radio :border="i.border ? i.border : false" v-for="j in i.data" :key="j.id || j.value" :label="j.id || j.value" name="type">
+            :disabled="i.disabled ? i.disabled : false"
+          >
+            <el-radio
+              :border="i.border ? i.border : false"
+              v-for="j in i.data"
+              :key="j.id || j.value"
+              :label="j.id || j.value"
+              name="type"
+            >
               {{ j.name || j.label }}
             </el-radio>
           </el-radio-group>
@@ -151,14 +198,16 @@
             :precision="i.precision !== '' ? i.precision : 2"
             :controls="i.controls === false ? false : true"
             :style="i.style"
-            onmousewheel="return false;">
+            onmousewheel="return false;"
+          >
           </el-input-number>
           <el-tree
             v-else-if="i.type == 'tree'"
             :data="i.data"
             :props="i.props"
             :readonly="i.readonly ? i.readonly : false"
-            :show-checkbox="i.showCheckbox || true">
+            :show-checkbox="i.showCheckbox || true"
+          >
           </el-tree>
           <el-cascader
             v-else-if="i.type == 'cascader'"
@@ -168,12 +217,15 @@
             :placeholder="i.placeholder || $t('common.pleaseSelect')"
             @change="(e) => commonsEmit(e, i)"
             :disabled="i.disabled ? i.disabled : false"
-            :style="i.style">
+            :style="i.style"
+          >
           </el-cascader>
           <!-- <div class="form-title" v-else-if="i.type == 'title'">
             {{ i.title }}
           </div> -->
-          <slot :name="i.slotName" v-else-if="i.type == 'slot'"> {{ i.slotName }}插槽占位符 </slot>
+          <slot :name="i.slotName" v-else-if="i.type == 'slot'">
+            {{ i.slotName }}插槽占位符
+          </slot>
           <div class="upload" v-else-if="i.type == 'upload'">
             <el-upload
               v-model="formData[i.prop]"
@@ -182,22 +234,39 @@
               list-type="picture-card"
               :on-remove="handleRemove"
               :on-success="handleSuccess"
-              :before-upload="handleBeforeUpload">
+              :before-upload="handleBeforeUpload"
+            >
               <!-- <el-icon class="el-icon--upload"><upload-filled /></el-icon> -->
               <el-icon><Plus /></el-icon>
             </el-upload>
           </div>
-          <div v-else-if="i.type == 'table'" class="by-form-table" style="width: 100%">
+          <div
+            v-else-if="i.type == 'table'"
+            class="by-form-table"
+            style="width: 100%"
+          >
             <el-table :data="formData[i.prop]" style="width: 100%">
-              <el-table-column :prop="j.prop" :label="j.label" :width="i.width" v-for="(j, jindex) in i.column">
+              <el-table-column
+                :prop="j.prop"
+                :label="j.label"
+                :width="i.width"
+                v-for="(j, jindex) in i.column"
+              >
                 <template #default="scope" v-if="j.type">
                   <component
                     @change="(e) => formTableChange(e, scope, j)"
                     v-model="scope.row[j.prop]"
                     :is="formTableObj[j.type]"
                     :placeholder="j.placeholder || $t('common.pleaseEnter')"
-                    :type="j.type == 'number' ? 'number' : 'text'">
-                    <el-option :label="n.title || n.name || n.label" :value="n.id || n.value" v-for="n in j.data" :key="n.id" v-if="j.type == 'select'">
+                    :type="j.type == 'number' ? 'number' : 'text'"
+                  >
+                    <el-option
+                      :label="n.title || n.name || n.label"
+                      :value="n.id || n.value"
+                      v-for="n in j.data"
+                      :key="n.id"
+                      v-if="j.type == 'select'"
+                    >
                     </el-option>
                   </component>
                 </template>
@@ -205,7 +274,14 @@
             </el-table>
           </div>
           <div v-else-if="i.type == 'json'">
-            <byForm :formConfig="i.json" :formOption="formOption" v-model="formData[i.prop]" ref="byform" :rules="rules"> </byForm>
+            <byForm
+              :formConfig="i.json"
+              :formOption="formOption"
+              v-model="formData[i.prop]"
+              ref="byform"
+              :rules="rules"
+            >
+            </byForm>
           </div>
         </el-form-item>
       </template>
@@ -243,8 +319,6 @@ defineProps({
   },
 });
 
-
-
 const formTableChange = (e, scope, column) => {
   if (column.fn) {
     column.fn(e, scope);
@@ -267,12 +341,14 @@ const handleSuccess = (res, file, files) => {
 };
 
 const handleRemove = (file) => {
-  const index = fileListCopy.value.findIndex((x) => x.uid === file.uid || x.id === file.id);
+  const index = fileListCopy.value.findIndex(
+    (x) => x.uid === file.uid || x.id === file.id
+  );
   fileListCopy.value.splice(index, 1);
 };
 
 const getLegacyData = (i) => {
-  console.log(i)
+  console.log(i);
 };
 
 const handleBeforeUpload = async (file) => {
@@ -294,7 +370,6 @@ const formData = computed(() => {
   return proxy.modelValue;
 });
 
-
 const formDataReset = ref({ ...proxy.modelValue });
 const commonsEmit = (prop, item) => {
   if (item.type == "input" && item.itemType == "number") {
@@ -311,7 +386,7 @@ const commonsEmitChange = (prop, item) => {
     formData.value[item.prop] = prop.trim();
   }
   if (item.fn) {
-    console.log(proxy.formConfig)
+    console.log(proxy.formConfig);
     item.fn(prop);
   }
   emit("update:modelValue", formData.value);
@@ -329,7 +404,7 @@ const dateFormatInit = (itemType) => {
   const formatObj = {
     year: "YYYY",
     month: "YYYY-MM",
-    date: "YYYY-MM-DD HH:mm:ss",
+    date: "YYYY-MM-DD",
     dates: "YYYY-MM-DD",
     datetime: "YYYY-MM-DD HH:mm:ss",
     monthrange: "YYYY-MM-DD HH:mm:ss",
@@ -358,9 +433,16 @@ const commonRecursive = (arr, labelKey, labelVal, childrenName) => {
       arr[i].children = arr[i][childrenName];
     }
     arr[i].checked = false;
-    typeof arr[i][labelVal] == String ? (arr[i].key = arr[i][labelVal]) : (arr[i].key = JSON.stringify(arr[i][labelVal]));
+    typeof arr[i][labelVal] == String
+      ? (arr[i].key = arr[i][labelVal])
+      : (arr[i].key = JSON.stringify(arr[i][labelVal]));
     if (childrenName) {
-      this.commonRecursive(arr[i][childrenName], labelKey, labelVal, childrenName);
+      this.commonRecursive(
+        arr[i][childrenName],
+        labelKey,
+        labelVal,
+        childrenName
+      );
     }
   }
 };
@@ -375,7 +457,12 @@ const commonGetdata = (isLoad, i) => {
     }
     proxy.formConfig[i].data = getFormat(isLoad.resUrl, message);
     if (isLoad.labelKey) {
-      commonRecursive(proxy.formConfig[i].data, isLoad.labelKey, isLoad.labelVal, isLoad.childrenName);
+      commonRecursive(
+        proxy.formConfig[i].data,
+        isLoad.labelKey,
+        isLoad.labelVal,
+        isLoad.childrenName
+      );
     }
     console.log(proxy.formConfig[i].data);
   });
@@ -384,7 +471,9 @@ const commonGetdata = (isLoad, i) => {
 //根据resurl获取数据
 const getFormat = (formatStr, props) => {
   if (!formatStr) return props;
-  return formatStr.split(".").reduce((total, cur) => (!total ? "" : total[cur]), props);
+  return formatStr
+    .split(".")
+    .reduce((total, cur) => (!total ? "" : total[cur]), props);
 };
 
 //初始化所有表单
@@ -461,7 +550,7 @@ loadInit();
 </script>
 
 <style>
-.box-item{
+.box-item {
   background-color: red;
 }
 .form-title {

+ 26 - 8
src/views/JXSK/production/workOrder/index.vue

@@ -24,7 +24,7 @@
     <el-dialog
       :title="'调整BOM'"
       v-model="dialogVisible"
-      width="800"
+      width="60%"
       v-loading="submitLoading"
       destroy-on-close
     >
@@ -90,11 +90,19 @@
         <el-button @click="dialogVisible = false" size="large">取 消</el-button>
         <el-button
           type="primary"
-          v-no-double-click="submitForm"
+          @click="submitForm(0)"
           size="large"
           :loading="submitLoading"
         >
-          确 定
+          暂 存
+        </el-button>
+        <el-button
+          type="primary"
+          @click="submitForm(1)"
+          size="large"
+          :loading="submitLoading"
+        >
+          提 交
         </el-button>
       </template>
     </el-dialog>
@@ -102,7 +110,7 @@
     <el-dialog
       title="调整工艺"
       v-model="dialogVisibleOne"
-      width="800"
+      width="60%"
       v-loading="loadingOne"
       destroy-on-close
     >
@@ -226,11 +234,19 @@
         >
         <el-button
           type="primary"
-          @click="submitFormOne('byform')"
+          @click="submitFormOne(0)"
+          size="large"
+          :loading="loadingOne"
+        >
+          暂 存
+        </el-button>
+        <el-button
+          type="primary"
+          @click="submitFormOne(1)"
           size="large"
           :loading="loadingOne"
         >
-          确 定
+          提 交
         </el-button>
       </template>
     </el-dialog>
@@ -453,8 +469,9 @@ const openModal = () => {
   formData.data = {};
 };
 
-const submitForm = () => {
+const submitForm = (type) => {
   byform.value.handleSubmit((valid) => {
+    formData.data.bomStatus = type;
     submitLoading.value = true;
     proxy.post("/workOrderBom/edit", formData.data).then(
       (res) => {
@@ -471,7 +488,7 @@ const submitForm = () => {
   });
 };
 
-const submitFormOne = () => {
+const submitFormOne = (type) => {
   byformOne.value.handleSubmit((valid) => {
     for (
       let i = 0;
@@ -494,6 +511,7 @@ const submitFormOne = () => {
       const e = formData.dataOne.workOrderProductionProcessesList[i];
       e.fileList = e.fileListCopy;
     }
+    formData.dataOne.technologyStatus = type;
     loadingOne.value = true;
     proxy.post("/workOrderProductionProcesses/edit", formData.dataOne).then(
       (res) => {

+ 482 - 0
src/views/JXSK/salesMange/contract/index.vue

@@ -0,0 +1,482 @@
+<template>
+  <div class="tenant">
+    <div class="content">
+      <byTable
+        :source="sourceList.data"
+        :pagination="sourceList.pagination"
+        :config="config"
+        :loading="loading"
+        highlight-current-row
+        :selectConfig="selectConfig"
+        :table-events="{
+          select: select,
+        }"
+        :action-list="[
+          {
+            text: '添加合同',
+            action: () => openModal('add'),
+          },
+        ]"
+        @get-list="getList"
+      >
+      </byTable>
+    </div>
+    <el-dialog
+      :title="modalType == 'add' ? '添加合同' : '查看合同'"
+      v-model="dialogVisible"
+      width="60%"
+      v-loading="loading"
+      destroy-on-close
+    >
+      <byForm
+        :formConfig="formConfig"
+        :formOption="formOption"
+        v-model="formData.data"
+        :rules="rules"
+        ref="byform"
+      >
+        <template #products>
+          <div style="width: 100%">
+            <el-button type="primary" plain @click="openProduct = true">
+              添加明细
+            </el-button>
+            <el-table
+              :data="formData.data.salesContractDetailsList"
+              style="margin-top: 10px"
+            >
+              <el-table-column prop="productName" label="产品名称" />
+              <el-table-column prop="isCustomized" label="是否定制">
+                <template #default="{ row, $index }">
+                  <el-form-item
+                    :prop="
+                      'salesContractDetailsList.' + $index + '.isCustomized'
+                    "
+                    :rules="rules.isCustomized"
+                    :inline-message="true"
+                  >
+                    <el-select
+                      v-model="row.isCustomized"
+                      class="m-2"
+                      placeholder="请选择"
+                    >
+                      <el-option key="1" label="是" value="1" />
+                      <el-option key="0" label="否" value="0" />
+                    </el-select>
+                  </el-form-item>
+                </template>
+              </el-table-column>
+              <el-table-column prop="unitPrice" label="单价">
+                <template #default="{ row, $index }">
+                  <el-form-item
+                    :prop="'salesContractDetailsList.' + $index + '.unitPrice'"
+                    :rules="rules.unitPrice"
+                    :inline-message="true"
+                  >
+                    <el-input-number
+                      onmousewheel="return false;"
+                      v-model="row.unitPrice"
+                      :precision="2"
+                      :controls="false"
+                      :min="0"
+                      @change="(val) => handleChangeTotal($index, val)"
+                    />
+                  </el-form-item>
+                </template>
+              </el-table-column>
+              <el-table-column prop="quantity" label="数量">
+                <template #default="{ row, $index }">
+                  <el-form-item
+                    :prop="'salesContractDetailsList.' + $index + '.quantity'"
+                    :rules="rules.quantity"
+                    :inline-message="true"
+                  >
+                    <el-input-number
+                      onmousewheel="return false;"
+                      v-model="row.quantity"
+                      :precision="2"
+                      :controls="false"
+                      :min="0"
+                      @change="(val) => handleChangeTotal($index, val)"
+                    />
+                  </el-form-item>
+                </template>
+              </el-table-column>
+              <el-table-column prop="total" label="金额小计" width="120" />
+
+              <el-table-column prop="zip" label="操作" width="80">
+                <template #default="{ $index }">
+                  <el-button type="primary" link @click="handleRemove($index)"
+                    >删除</el-button
+                  >
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+        </template>
+      </byForm>
+      <template #footer>
+        <el-button @click="dialogVisible = false" size="large">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="submitForm()"
+          size="large"
+          :loading="submitLoading"
+          v-if="modalType == 'add'"
+        >
+          确 定
+        </el-button>
+      </template>
+    </el-dialog>
+
+    <el-dialog v-model="openProduct" title="选择产品" width="70%">
+      <SelectProduct @handleSelect="handleSelect"></SelectProduct>
+      <template #footer>
+        <span class="dialog-footer">
+          <el-button @click="openProduct = false">取消</el-button>
+        </span>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+import { ElMessage, ElMessageBox } from "element-plus";
+import byTable from "@/components/byTable/index";
+import byForm from "@/components/byForm/index";
+import SelectProduct from "@/components/product/SelectProduct";
+
+const { proxy } = getCurrentInstance();
+const loading = ref(false);
+const submitLoading = ref(false);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 3,
+    pageNum: 1,
+    pageSize: 10,
+    keyword: "",
+  },
+});
+const dialogVisible = ref(false);
+const modalType = ref("add");
+const rules = ref({
+  customerId: [
+    { required: true, message: "请选择客户名称", trigger: "change" },
+  ],
+  deliveryDate: [
+    { required: true, message: "请选择交货期限", trigger: "change" },
+  ],
+  payMethod: [{ required: true, message: "请选择付款方式", trigger: "change" }],
+  freightPayer: [
+    { required: true, message: "请选择运费支付方", trigger: "change" },
+  ],
+  isCustomized: [
+    { required: true, message: "请选择是否定制", trigger: "change" },
+  ],
+  unitPrice: [{ required: true, message: "请输入单价", trigger: "blur" }],
+  quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
+});
+const selectConfig = reactive([]);
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "合同号",
+        prop: "code",
+      },
+    },
+    {
+      attrs: {
+        label: "客户名称",
+        prop: "customerName",
+      },
+    },
+
+    {
+      attrs: {
+        label: "合同金额",
+        prop: "contractAmount",
+      },
+      render(contractAmount) {
+        return proxy.moneyFormat(contractAmount, 2);
+      },
+    },
+    {
+      attrs: {
+        label: "签订时间",
+        prop: "createTime",
+      },
+    },
+    {
+      attrs: {
+        label: "交货期限",
+        prop: "deliveryDate",
+      },
+    },
+    {
+      attrs: {
+        label: "付款方式",
+        prop: "payMethod",
+      },
+      render(payMethod) {
+        return proxy.dictValueLabel(payMethod, payMethodData.value);
+      },
+    },
+    {
+      attrs: {
+        label: "运费支付方",
+        prop: "freightPayer",
+      },
+      render(freightPayer) {
+        return proxy.dictValueLabel(freightPayer, freightPayerData.value);
+      },
+    },
+    {
+      attrs: {
+        label: "备注",
+        prop: "remark",
+      },
+    },
+    {
+      attrs: {
+        label: "操作",
+        width: "80",
+        align: "center",
+      },
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "查看",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              getDtl(row);
+            },
+          },
+        ];
+      },
+    },
+  ];
+});
+const formData = reactive({
+  data: {},
+});
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
+});
+const byform = ref(null);
+const formConfig = computed(() => {
+  return [
+    {
+      type: "select",
+      prop: "customerId",
+      label: "客户名称",
+      required: true,
+      filterable: true,
+      data: customerData.value,
+    },
+    {
+      type: "date",
+      itemType: "date",
+      prop: "deliveryDate",
+      label: "交货期限",
+      required: true,
+    },
+    {
+      type: "select",
+      prop: "payMethod",
+      label: "付款方式",
+      required: true,
+      data: payMethodData.value,
+    },
+    {
+      type: "select",
+      prop: "freightPayer",
+      label: "运费支付方",
+      required: true,
+      data: freightPayerData.value,
+    },
+    {
+      type: "number",
+      disabled: true,
+      prop: "total",
+      label: "合同总金额",
+      precision: 2,
+      min: 0,
+      controls: false,
+      // style: {
+      //   width: "100%",
+      // },
+    },
+    {
+      type: "input",
+      itemType: "textarea",
+      prop: "remark",
+      label: "备注",
+    },
+    {
+      type: "slot",
+      slotName: "products",
+      label: "合同明细",
+    },
+  ];
+});
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy
+    .post("/salesContract/page", sourceList.value.pagination)
+    .then((message) => {
+      sourceList.value.data = message.rows;
+      sourceList.value.pagination.total = message.total;
+      setTimeout(() => {
+        loading.value = false;
+      }, 200);
+    });
+};
+const openModal = () => {
+  dialogVisible.value = true;
+  modalType.value = "add";
+  formOption.disabled = false;
+  formData.data = {
+    salesContractDetailsList: [],
+  };
+};
+
+const submitForm = () => {
+  byform.value.handleSubmit(() => {
+    if (!formData.data.salesContractDetailsList.length > 0) {
+      return ElMessage({
+        message: "请添加合同明细",
+        type: "info",
+      });
+    }
+    submitLoading.value = true;
+    proxy
+      .post("/flowProcess/initiate", {
+        flowKey: "jxst_sales_contract_flow",
+        data: formData.data,
+      })
+      .then(
+        () => {
+          ElMessage({
+            message: "添加成功",
+            type: "success",
+          });
+          dialogVisible.value = false;
+          submitLoading.value = false;
+          getList();
+        },
+        (err) => {
+          console.log(err);
+          submitLoading.value = false;
+        }
+      );
+  });
+};
+const getDtl = (row) => {
+  modalType.value = "detail";
+  formOption.disabled = true;
+  proxy.post("/salesContract/detail", { id: row.id }).then((res) => {
+    if (res && res.contractDetailsList.length > 0) {
+      res.salesContractDetailsList = res.contractDetailsList;
+    } else {
+      res.salesContractDetailsList = [];
+    }
+    formData.data = res;
+    changeAmount();
+    dialogVisible.value = true;
+  });
+};
+
+const customerData = ref([]);
+const payMethodData = ref([]);
+const freightPayerData = ref([
+  {
+    label: "甲方",
+    value: "0",
+  },
+  {
+    label: "乙方",
+    value: "1",
+  },
+]);
+const getDict = () => {
+  proxy.post("/customer/page", { pageNum: 1, pageSize: 9999 }).then((res) => {
+    customerData.value = res.rows.map((x) => ({
+      label: x.name,
+      value: x.id,
+    }));
+  });
+  proxy.getDict(["funds_payment_method"]).then((res) => {
+    payMethodData.value = res["funds_payment_method"].map((x) => ({
+      label: x.dictValue,
+      value: x.dictKey,
+    }));
+  });
+};
+getDict();
+getList();
+const openProduct = ref(false);
+const handleSelect = (row) => {
+  const flag = formData.data.salesContractDetailsList.some(
+    (x) => x.productId === row.id
+  );
+  if (!flag) {
+    formData.data.salesContractDetailsList.push({
+      productName: row.name + ` (${row.spec})`,
+      productId: row.id,
+      quantity: null,
+    });
+    return ElMessage({
+      message: "选择成功",
+      type: "success",
+    });
+  }
+  return ElMessage({
+    message: "该产品已选择",
+    type: "info",
+  });
+};
+const handleRemove = (index) => {
+  formData.data.salesContractDetailsList.splice(index, 1);
+  changeAmount();
+};
+
+const changeAmount = () => {
+  let total = 0;
+  for (let i = 0; i < formData.data.salesContractDetailsList.length; i++) {
+    const e = formData.data.salesContractDetailsList[i];
+    e.total = e.quantity * e.unitPrice;
+    total += e.total;
+  }
+  formData.data.total = parseFloat(total).toFixed(2);
+};
+const handleChangeTotal = (index, val) => {
+  if (
+    formData.data.salesContractDetailsList[index].unitPrice &&
+    formData.data.salesContractDetailsList[index].quantity
+  ) {
+    formData.data.salesContractDetailsList[index].total = parseFloat(
+      formData.data.salesContractDetailsList[index].unitPrice *
+        formData.data.salesContractDetailsList[index].quantity
+    ).toFixed(2);
+    changeAmount();
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.tenant {
+  padding: 20px;
+}
+::v-deep(.el-input-number .el-input__inner) {
+  text-align: left;
+}
+</style>