Andy 3 سال پیش
والد
کامیت
29012910cb

+ 2 - 1
src/routerMap/index.js

@@ -249,7 +249,8 @@ const routerMap = [{
         path: '/cms/proceduremannage/index',
         name: 'ProcedureMannage', //工序管理通用页面
         meta: {
-            index: 4
+            index: 4,
+            keepAlive: true,
         },
         component: (resolve) =>
             require(['@/views/ProcedureMannage/index'], resolve),

+ 1 - 1
src/views/BasicSettings/SuppliersManage/SippliersList.vue

@@ -338,7 +338,7 @@ export default {
     },
     handleTreeSelect(arr, row) {
       console.log("row :>> ", row);
-      this.searchData.code = row.code;
+      this.searchData.type_id = row.id;
       this.suppliersTypeTitle = row.title;
       this.suppliersTypeId = row.id;
       this.initData(this.searchData);

+ 274 - 213
src/views/BasicSettings/SuppliersManage/SippliersListEdit.vue

@@ -1,107 +1,131 @@
 <template>
   <div class="SippliersListEdit">
-    <Toptitle :title="$route.query.type==1?'新增供应商':$route.query.type==2?'编辑供应商':'查看供应商'">
+    <Toptitle
+      :title="
+        $route.query.type == 1
+          ? '新增供应商'
+          : $route.query.type == 2
+          ? '编辑供应商'
+          : '查看供应商'
+      "
+    >
       <slot name="titleButton">
-        <Button @click="goBack()"
-                type="primary"
-                style="margin-right:10px;">返回</Button>
-        <Button @click="postForm('formValidate')"
-                type="primary"
-                style="margin-right:10px;">保存</Button>
+        <Button @click="goBack()" type="primary" style="margin-right:10px;"
+          >返回</Button
+        >
+        <Button
+          @click="postForm('formValidate')"
+          type="primary"
+          style="margin-right:10px;"
+          >保存</Button
+        >
       </slot>
     </Toptitle>
     <div class="content_form">
-      <Form ref="formValidate"
-            :model="formData"
-            :rules="ruleValidate"
-            :label-width="120">
+      <Form
+        ref="formValidate"
+        :model="formData"
+        :rules="ruleValidate"
+        :label-width="120"
+      >
         <FormItem label="供应商分类:">
-          <span>{{formData.type_title}}</span>
+          <span>{{ formData.type_title }}</span>
         </FormItem>
-        <FormItem label="业务员:"
-                  prop="user">
-          <Select v-model="formData.sys_user_id"
-                  style="width:200px">
-            <Option v-for="item in salesmanList"
-                    :value="item.id"
-                    :key="item.id">{{ item.nickname }}</Option>
+        <FormItem label="业务员:" prop="user">
+          <Select v-model="formData.sys_user_id" style="width:200px">
+            <Option
+              v-for="item in salesmanList"
+              :value="item.id"
+              :key="item.id"
+              >{{ item.nickname }}</Option
+            >
           </Select>
         </FormItem>
-        <FormItem label="供应商编码:"
-                  prop="code">
-          <Input v-model="formData.code"
-                 style="width:200px"
-                 placeholder="请输入供应商编码"></Input>
+        <FormItem label="供应商编码:" prop="code">
+          <Input
+            v-model="formData.code"
+            style="width:200px"
+            placeholder="请输入供应商编码"
+          />
           <!-- :disabled="$route.query.type==2" -->
         </FormItem>
-        <FormItem label="供应商联系人:"
-                  prop="contact">
-          <Input v-model="formData.contact"
-                 style="width:200px"
-                 placeholder="请输入供应商联系人"></Input>
+        <FormItem label="供应商联系人:" prop="contact">
+          <Input
+            v-model="formData.contact"
+            style="width:200px"
+            placeholder="请输入供应商联系人"
+          />
         </FormItem>
-        <FormItem label="供应商名称:"
-                  prop="title">
-          <Input v-model="formData.title"
-                 style="width:200px"
-                 placeholder="请输入供应商名称"></Input>
+        <FormItem label="供应商名称:" prop="title">
+          <Input
+            v-model="formData.title"
+            style="width:200px"
+            placeholder="请输入供应商名称"
+          />
         </FormItem>
-        <FormItem label="联系人手机号:"
-                  prop="mobile">
-          <Input v-model="formData.mobile"
-                 style="width:200px"
-                 placeholder="请输入联系人手机号"></Input>
+        <FormItem label="联系人手机号:" prop="mobile">
+          <Input
+            v-model="formData.mobile"
+            style="width:200px"
+            placeholder="请输入联系人手机号"
+          />
         </FormItem>
-        <FormItem label="地区:"
-                  prop="area">
-          <Tooltip :content="formData.area"
-                   placement="top">
-            <Input v-model="formData.area"
-                   readonly
-                   style="width:200px"
-                   placeholder="请选择地区">
-            <Button @click="showModal=true"
-                    slot="append">选择</Button></Input>
+        <FormItem label="地区:" prop="area">
+          <Tooltip :content="formData.area" placement="top">
+            <Input
+              v-model="formData.area"
+              readonly
+              style="width:200px"
+              placeholder="请选择地区"
+            >
+              <Button @click="showModal = true" slot="append"
+                >选择</Button
+              ></Input
+            >
           </Tooltip>
         </FormItem>
-        <FormItem label="是否启用:"
-                  prop="state">
-          <Select v-model="formData.state"
-                  style="width:200px">
-            <Option :value=1>启用</Option>
-            <Option :value=0>停用</Option>
+        <FormItem label="是否启用:" prop="state">
+          <Select v-model="formData.state" style="width:200px">
+            <Option :value="1">启用</Option>
+            <Option :value="0">停用</Option>
           </Select>
         </FormItem>
-        <FormItem label="地址:"
-                  prop="address">
-          <Input v-model="formData.address"
-                 style="width:200px"
-                 type="textarea"
-                 placeholder="请输入地址"></Input>
+        <FormItem label="地址:" prop="address">
+          <Input
+            v-model="formData.address"
+            style="width:200px"
+            type="textarea"
+            placeholder="请输入地址"
+          />
         </FormItem>
         <FormItem label="备注:">
-          <Input v-model="formData.remark"
-                 style="width:200px"
-                 type="textarea"
-                 placeholder="请输入备注"></Input>
+          <Input
+            v-model="formData.remark"
+            style="width:200px"
+            type="textarea"
+            placeholder="请输入备注"
+          />
         </FormItem>
       </Form>
     </div>
-    <Modal v-model="showModal"
-           title="查看"
-           @on-ok="handleAreaSelect"
-           @on-cancel="showModal=false">
+    <Modal v-model="showModal" title="查看">
       <div class="content">
         <div class="content_left">
-          <Tree :data="treeData"
-                :render="renderContent"
-                children-key='sub'
-                @on-select-change="handleTreeSlect"
-                style="width:100%;"
-                class="demo-tree-render"></Tree>
+          <Tree
+            :data="treeData"
+            :render="renderContent"
+            children-key="sub"
+            @on-select-change="handleTreeSlect"
+            style="width:100%;"
+            class="demo-tree-render"
+          ></Tree>
         </div>
         <div class="content_right"></div>
       </div>
+      <div slot="footer">
+        <Button @click="showModal = false" type="primary" ghost>取消</Button>
+        <Button @click="handleAreaSelect" type="primary">确定</Button>
+      </div>
     </Modal>
   </div>
 </template>
@@ -111,175 +135,212 @@
 // 例如:import 《组件名称》 from '《组件路径》';
 
 export default {
-  name: 'SippliersListEdit',
-  components: {
-
-  },
+  name: "SippliersListEdit",
+  components: {},
   props: {},
   // import引入的组件需要注入到对象中才能使用
-  data () {
+  data() {
     // 这里存放数据
     return {
       formData: {
-        title: '',
-        mobile: '',
-        contact: '',
+        title: "",
+        mobile: "",
+        contact: "",
         sys_user_id: 0,
-        state: '',
-        area: '',
-        address: '',
-        basics_supply_id: '',
-        remark: ''
+        state: "",
+        area: "",
+        address: "",
+        basics_supply_id: "",
+        remark: "",
       },
       ruleValidate: {
-        code: [{ required: true, message: '请填写供应商编码', trigger: 'blur' }],
-        title: [{ required: true, message: '请填写名称', trigger: 'blur' }],
-        mobile: [{ required: true, message: '请填写手机号', trigger: 'blur' }],
-        contact: [{ required: true, message: '请填写联系人', trigger: 'blur' }],
+        code: [
+          { required: true, message: "请填写供应商编码", trigger: "blur" },
+        ],
+        title: [{ required: true, message: "请填写名称", trigger: "blur" }],
+        mobile: [{ required: true, message: "请填写手机号", trigger: "blur" }],
+        contact: [{ required: true, message: "请填写联系人", trigger: "blur" }],
         // user: [{ required: true, message: '请选择业务员', trigger: 'change' }],
-        state: [{ required: true, type: 'number', message: '请选择是否启用', trigger: 'change' }],
-        area: [{ required: true, message: '请选择地区', trigger: 'change' }],
-        address: [{ required: true, message: '请填写地址', trigger: 'blur' }],
+        state: [
+          {
+            required: true,
+            type: "number",
+            message: "请选择是否启用",
+            trigger: "change",
+          },
+        ],
+        area: [{ required: true, message: "请选择地区", trigger: "change" }],
+        address: [{ required: true, message: "请填写地址", trigger: "blur" }],
       },
       salesmanList: [],
-      tempAreaTitle: '',
+      tempAreaTitle: "",
       showModal: false,
       treeData: [
         {
-          title: '地区分类',
+          title: "地区分类",
           expand: 1,
           contextmenu: 1,
           id: 0,
-          sub: [
-
-          ],
+          sub: [],
           render: (h, { root, node, data }) => {
-            return h('span', {
-              style: {
-                display: 'inline-block',
-                width: '100%'
-              }
-            }, [
-              h('span', [
-                h('Icon', {
-                  props: {
-                    type: 'ios-folder-outline'
-                  },
-                  style: {
-                    marginRight: '8px'
-                  }
-                }),
-                h('span', data.title)
-              ]),
-              h('span', {
+            return h(
+              "span",
+              {
                 style: {
-                  display: 'inline-block',
-                  float: 'right',
-                  marginRight: '32px'
-                }
-              }, [])
-            ]);
+                  display: "inline-block",
+                  width: "100%",
+                },
+              },
+              [
+                h("span", [
+                  h("Icon", {
+                    props: {
+                      type: "ios-folder-outline",
+                    },
+                    style: {
+                      marginRight: "8px",
+                    },
+                  }),
+                  h("span", data.title),
+                ]),
+                h(
+                  "span",
+                  {
+                    style: {
+                      display: "inline-block",
+                      float: "right",
+                      marginRight: "32px",
+                    },
+                  },
+                  []
+                ),
+              ]
+            );
           },
-        }
+        },
       ],
-      tempAreaObj: {}
-    }
+      tempAreaObj: {},
+    };
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
-  created () {
-    this.$route.query.type == 1 ? this.formData.type_title = this.$route.query.title : ''
-    this.$route.query.type == 1 ? this.formData.basics_supply_id = this.$route.query.basics_supply_id : ''
+  created() {
+    this.$route.query.type == 1
+      ? (this.formData.type_title = this.$route.query.title)
+      : "";
+    this.$route.query.type == 1
+      ? (this.formData.basics_supply_id = this.$route.query.basics_supply_id)
+      : "";
   },
   // 生命周期 - 挂载完成(可以访问DOM元素)
-  mounted () {
-    this.axios('/api/user').then(res => this.salesmanList = res.data.data)
-    this.axios('/api/basic_area_list').then(res => this.treeData[0].sub = res.data)
-    this.$route.query.type == 2 ?
-      this.axios({
-        method: 'get',
-        url: '/api/supply_detail',
-        params: {
-          id: this.$route.query.id
-        }
-      }).then((res) => {
-        this.formData = res.data
-      }).catch((err) => { }) : ''
+  mounted() {
+    this.axios("/api/user").then((res) => (this.salesmanList = res.data.data));
+    this.axios("/api/basic_area_list").then(
+      (res) => (this.treeData[0].sub = res.data)
+    );
+    this.$route.query.type == 2
+      ? this.axios({
+          method: "get",
+          url: "/api/supply_detail",
+          params: {
+            id: this.$route.query.id,
+          },
+        })
+          .then((res) => {
+            this.formData = res.data;
+          })
+          .catch((err) => {})
+      : "";
   },
   methods: {
-    goBack () { this.$router.go(-1) },
-    postForm (name) {
+    goBack() {
+      this.$router.go(-1);
+    },
+    postForm(name) {
       this.$refs[name].validate((valid) => {
         if (valid) {
-          this.$route.query.type == 1 ?
-            this.axios({
-              method: 'post',
-              url: '/api/supply_add',
-              data: {
-                ...this.formData
-              }
-            }).then((res) => {
-              this.$Message.success(res.msg);
-              this.goBack()
-            }).catch((err) => { })
-            :
-            this.axios({
-              method: 'post',
-              url: '/api/supply_edit',
-              data: {
-                ...this.formData
-              }
-            }).then((res) => {
-              this.$Message.success(res.msg);
-              this.goBack()
-            }).catch((err) => { });
+          this.$route.query.type == 1
+            ? this.axios({
+                method: "post",
+                url: "/api/supply_add",
+                data: {
+                  ...this.formData,
+                },
+              })
+                .then((res) => {
+                  this.$Message.success(res.msg);
+                  this.goBack();
+                })
+                .catch((err) => {})
+            : this.axios({
+                method: "post",
+                url: "/api/supply_edit",
+                data: {
+                  ...this.formData,
+                },
+              })
+                .then((res) => {
+                  this.$Message.success(res.msg);
+                  this.goBack();
+                })
+                .catch((err) => {});
         } else {
-          this.$Message.error('请填写完整!');
+          this.$Message.error("请填写完整!");
         }
-      })
+      });
     },
-    handleAreaSelect () {
-      this.tempAreaObj.title != '地区分类' && (this.formData.area = this.tempAreaObj.title, this.formData.basics_area_id = this.tempAreaObj.id)
-      // this.showModal = false
+    handleAreaSelect() {
+      if (this.tempAreaObj.sub && this.tempAreaObj.sub.length > 0) {
+        this.$Message.warning("请选择最后级");
+      } else {
+        this.tempAreaObj.title != "地区分类" &&
+          ((this.formData.area = this.tempAreaObj.title),
+          (this.formData.basics_area_id = this.tempAreaObj.id));
+        this.showModal = false;
+      }
     },
-    handleTreeSlect (arr, row) {
-      console.log('arr :>> ', arr);
-      console.log('row :>> ', row);
-      this.tempAreaObj = row
+    handleTreeSlect(arr, row) {
+      console.log("arr :>> ", arr);
+      console.log("row :>> ", row);
+      this.tempAreaObj = row;
       // this.formData.area = row.title
       // this.formData.basics_area_id = row.id
     },
-    renderContent (h, { root, node, data }) {
-      return h('span', {
-        style: {
-          display: 'inline-block',
-          width: '100%'
-        }
-      }, [
-        h('span', [
-          h('Icon', {
-            props: {
-              type: 'ios-paper-outline'
-            },
+    renderContent(h, { root, node, data }) {
+      return h(
+        "span",
+        {
+          style: {
+            display: "inline-block",
+            width: "100%",
+          },
+        },
+        [
+          h("span", [
+            h("Icon", {
+              props: {
+                type: "ios-paper-outline",
+              },
+              style: {
+                marginRight: "8px",
+              },
+            }),
+            h("span", `${data.title}(${data.code})`),
+          ]),
+          h("span", {
             style: {
-              marginRight: '8px'
-            }
+              display: "inline-block",
+              float: "right",
+              marginRight: "32px",
+            },
           }),
-          h('span', `${data.title}(${data.code})`)
-        ]),
-        h('span', {
-          style: {
-            display: 'inline-block',
-            float: 'right',
-            marginRight: '32px'
-          }
-        })
-      ]);
+        ]
+      );
     },
-    openChildrenNode (arr) {
-      arr.forEach(element => {
-        element.expand = true
+    openChildrenNode(arr) {
+      arr.forEach((element) => {
+        element.expand = true;
         if (element.sub && element.sub.length > 0) {
-          return this.openChildrenNode(element.sub)
+          return this.openChildrenNode(element.sub);
         }
       });
     },
@@ -288,17 +349,17 @@ export default {
   computed: {},
   // 监控data中的数据变化
   watch: {},
-  beforeCreate () { }, // 生命周期 - 创建之前
-  beforeMount () { }, // 生命周期 - 挂载之前
-  beforeUpdate () { }, // 生命周期 - 更新之前
-  updated () { }, // 生命周期 - 更新之后
-  beforeDestroy () { }, // 生命周期 - 销毁之前
-  destroyed () { }, // 生命周期 - 销毁完成
-  activated () { }, // 如果页面有keep-alive缓存功能,这个函数会触发
-}
+  beforeCreate() {}, // 生命周期 - 创建之前
+  beforeMount() {}, // 生命周期 - 挂载之前
+  beforeUpdate() {}, // 生命周期 - 更新之前
+  updated() {}, // 生命周期 - 更新之后
+  beforeDestroy() {}, // 生命周期 - 销毁之前
+  destroyed() {}, // 生命周期 - 销毁完成
+  activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
+};
 </script>
 
-<style lang='scss' scoped>
+<style lang="scss" scoped>
 .content_form {
   padding: 20px;
   /deep/.ivu-form {

+ 1 - 1
src/views/BidSystem/ProductDeOrder/deorderdetail.vue

@@ -1225,7 +1225,7 @@ export default {
       })
         .then((res) => {
           this.formData = res.data;
-          this.formData.basic_product_id = 8;
+          // this.formData.basic_product_id = 8;
           // 获取产品分类、测量字段
           this.handleMatchBP(this.productTypes, this.formData.basic_product_id);
           this.handleClick(JSON.stringify(this.nowSelectObj));

+ 276 - 254
src/views/MaterialMannage/edit.vue

@@ -1,250 +1,247 @@
 <template>
   <div>
-    <Toptitle :title='setTip'>
-      <Button @click="back"
-              type='primary'
-              ghost
-              style="margin-right:10px;">返回</Button>
-      <Button v-if="type != 3"
-              type="primary"
-              @click="handleSubmit('Info','item_detail')">保存</Button>
+    <Toptitle :title="setTip">
+      <Button @click="back" type="primary" ghost style="margin-right:10px;"
+        >返回</Button
+      >
+      <Button
+        v-if="type != 3"
+        type="primary"
+        @click="handleSubmit('Info', 'item_detail')"
+        >保存</Button
+      >
     </Toptitle>
-    <Form ref='Info'
-          inline
-          :model='info'
-          :rules='rules'>
+    <Form ref="Info" inline :model="info" :rules="rules">
       <FormItem label="ID">
-        <Input v-model="info.id"
-               disabled
-               :placeholder="type == 1||type == 2 ? '自动生成': '12'" />
+        <Input
+          v-model="info.id"
+          disabled
+          :placeholder="type == 1 || type == 2 ? '自动生成' : '12'"
+        />
       </FormItem>
-      <FormItem label="物料名称"
-                prop='title'>
-        <Input :disabled='type == 3 ? true : false'
-               v-model="info.title"
-               placeholder="请输入物料名称" />
+      <FormItem label="物料名称" prop="title">
+        <Input
+          :disabled="type == 3 ? true : false"
+          v-model="info.title"
+          placeholder="请输入物料名称"
+        />
       </FormItem>
-      <!-- <FormItem label="物料分类"
-                prop='m_id'>
-        <Select filterable
-                clearable
-                style="width:186px;"
-                v-model="info.m_id"
-                :disabled='type == 3 ? true : false'
-                placeholder="请选择材质">
-          <Option v-for="item of materialList"
-                  :key="item.id"
-                  :label="item.title"
-                  :value="item.id"></Option>
+      <FormItem label="物料分类" prop="m_id">
+        <Select
+          filterable
+          clearable
+          style="width:186px;"
+          v-model="info.m_id"
+          :disabled="type == 3"
+          placeholder="请选择材质"
+        >
+          <Option
+            v-for="item of materialList"
+            :key="item.id"
+            :label="item.title"
+            :value="item.id"
+          ></Option>
         </Select>
-      </FormItem> -->
-      <FormItem label="厚"
-                v-show="isShowInfoHigh"
-                prop='high'>
-        <Input :disabled='type == 3 ? true : false'
-               v-model="info.high"
-               placeholder="请输入厚度" />
       </FormItem>
-      <FormItem label="单位"
-                prop='unit'>
-        <Input :disabled='type == 3 ? true : false'
-               v-model="info.unit"
-               placeholder="请输入单位" />
+      <FormItem label="厚" v-show="isShowInfoHigh" prop="high">
+        <Input
+          :disabled="type == 3 ? true : false"
+          v-model="info.high"
+          placeholder="请输入厚度"
+        />
       </FormItem>
-      <FormItem label="损耗(%)"
-                v-show="info.detail.length==0"
-                prop='scale'>
-        <Input type="number"
-               :disabled='type == 3 ? true : false'
-               v-model="info.scale"
-               placeholder="请输入百分比" />
+      <FormItem label="单位" prop="unit">
+        <Input
+          :disabled="type == 3 ? true : false"
+          v-model="info.unit"
+          placeholder="请输入单位"
+        />
+      </FormItem>
+      <FormItem label="损耗(%)" v-show="info.detail.length == 0" prop="scale">
+        <Input
+          type="number"
+          :disabled="type == 3 ? true : false"
+          v-model="info.scale"
+          placeholder="请输入百分比"
+        />
       </FormItem>
       <FormItem label="描述">
-        <Input :disabled='type == 3 ? true : false'
-               v-model="info.remark"
-               placeholder="请输入描述" />
+        <Input
+          :disabled="type == 3 ? true : false"
+          v-model="info.remark"
+          placeholder="请输入描述"
+        />
       </FormItem>
-      <FormItem label="安全库存"
-                v-show="isShowInfoMinStock"
-                prop='stock'>
-        <Input type="number"
-               :disabled='type == 3 ? true : false'
-               v-model="info.warning_number"
-               placeholder="请输入库存" />
+      <FormItem label="安全库存" v-show="isShowInfoMinStock" prop="stock">
+        <Input
+          type="number"
+          :disabled="type == 3 ? true : false"
+          v-model="info.warning_number"
+          placeholder="请输入库存"
+        />
       </FormItem>
-      <FormItem label="最高库存"
-                v-show="isShowInfoTopNumber"
-                prop='stock'>
-        <Input type="number"
-               :disabled='type == 3 ? true : false'
-               v-model="info.top_number"
-               placeholder="请输入库存" />
+      <FormItem label="最高库存" v-show="isShowInfoTopNumber" prop="stock">
+        <Input
+          type="number"
+          :disabled="type == 3 ? true : false"
+          v-model="info.top_number"
+          placeholder="请输入库存"
+        />
       </FormItem>
-      <FormItem label="单价(元)"
-                v-show="isShowInfoPrice"
-                prop='price'>
-        <Input type="number"
-               :disabled='type == 3 ? true : false'
-               v-model="info.price"
-               placeholder="请输入金额" />
+      <FormItem label="单价(元)" v-show="isShowInfoPrice" prop="price">
+        <Input
+          type="number"
+          :disabled="type == 3 ? true : false"
+          v-model="info.price"
+          placeholder="请输入金额"
+        />
       </FormItem>
     </Form>
-    <div class="page-edit"
-         v-show="isShowDetail"
-         style="padding-bottom:100px;">
-      <div class="items"
-           v-for="(rows,key) in info.detail"
-           :key="key">
+    <div class="page-edit" v-show="isShowDetail" style="padding-bottom:100px;">
+      <div class="items" v-for="(rows, key) in info.detail" :key="key">
         <!-- id  1 木板   2 木皮   3 实木   4 辅料   5 五金   6 油漆  -->
-        <Form ref='item_detail'
-              inline
-              :model="rows"
-              :rules='itemRules'>
-          <FormItem label="高"
-                    prop='long'
-                    v-show="isShowDetailLong">
-            <Input :disabled='type == 3 ? true : false'
-                   v-model="rows.long"
-                   placeholder="请输入高度" />
+        <Form ref="item_detail" inline :model="rows" :rules="itemRules">
+          <FormItem label="高" prop="long" v-show="isShowDetailLong">
+            <Input
+              :disabled="type == 3 ? true : false"
+              v-model="rows.long"
+              placeholder="请输入高度"
+            />
           </FormItem>
-          <FormItem label="宽"
-                    prop='width'
-                    v-show="isShowDetailWidth">
-            <Input :disabled='type == 3 ? true : false'
-                   v-model="rows.width"
-                   placeholder="请输入宽度" />
+          <FormItem label="宽" prop="width" v-show="isShowDetailWidth">
+            <Input
+              :disabled="type == 3 ? true : false"
+              v-model="rows.width"
+              placeholder="请输入宽度"
+            />
           </FormItem>
           <FormItem label="损耗(%)">
-            <Input type="number"
-                   :disabled='type == 3 ? true : false'
-                   v-model="rows.scale"
-                   placeholder="请输入百分比" />
+            <Input
+              type="number"
+              :disabled="type == 3 ? true : false"
+              v-model="rows.scale"
+              placeholder="请输入百分比"
+            />
           </FormItem>
-          <FormItem label="价格计算方式"
-                    prop='todo'
-                    v-show="isShowDetailCalc">
-            <Select filterable
-                    clearable
-                    style="width:186px;"
-                    v-model="rows.todo"
-                    placeholder="请选择">
-              <Option v-for="item of priceMathList"
-                      :key="item.value"
-                      :label="item.label"
-                      :value="item.value"></Option>
+          <FormItem label="价格计算方式" prop="todo" v-show="isShowDetailCalc">
+            <Select
+              filterable
+              clearable
+              style="width:186px;"
+              v-model="rows.todo"
+              placeholder="请选择"
+            >
+              <Option
+                v-for="item of priceMathList"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              ></Option>
             </Select>
           </FormItem>
           <FormItem label="安全库存">
-            <Input type="number"
-                   :disabled='type == 3 ? true : false'
-                   v-model="rows.warning_number"
-                   placeholder="请输入库存" />
+            <Input
+              type="number"
+              :disabled="type == 3 ? true : false"
+              v-model="rows.warning_number"
+              placeholder="请输入库存"
+            />
           </FormItem>
           <FormItem label="最高库存">
-            <Input type="number"
-                   :disabled='type == 3 ? true : false'
-                   v-model="rows.top_number"
-                   placeholder="请输入库存" />
+            <Input
+              type="number"
+              :disabled="type == 3 ? true : false"
+              v-model="rows.top_number"
+              placeholder="请输入库存"
+            />
           </FormItem>
-          <FormItem label="单价(元)"
-                    prop='price'>
-            <Input type="number"
-                   :disabled='type == 3 ? true : false'
-                   v-model="rows.price"
-                   placeholder="请输入金额" />
+          <FormItem label="单价(元)" prop="price">
+            <Input
+              type="number"
+              :disabled="type == 3 ? true : false"
+              v-model="rows.price"
+              placeholder="请输入金额"
+            />
           </FormItem>
-          <FormItem label='操作'
-                    v-if="isShowDetailBtn">
-            <div style="width:100%;display:flex;height:100%;align-items:center;">
-              <Button type='success'
-                      ghost
-                      :disabled='type == 3 ? true : false'
-                      @click="addMaterrial(info.detail)">添加</Button>
-              <Button type="error"
-                      ghost
-                      v-if="info.detail.length!=1&&type!=3"
-                      style="margin-left:10px;"
-                      @click="removeChild(info.detail,key)">删除</Button>
+          <FormItem label="操作" v-if="isShowDetailBtn">
+            <div
+              style="width:100%;display:flex;height:100%;align-items:center;"
+            >
+              <Button
+                type="success"
+                ghost
+                :disabled="type == 3 ? true : false"
+                @click="addMaterrial(info.detail)"
+                >添加</Button
+              >
+              <Button
+                type="error"
+                ghost
+                v-if="info.detail.length != 1 && type != 3"
+                style="margin-left:10px;"
+                @click="removeChild(info.detail, key)"
+                >删除</Button
+              >
             </div>
           </FormItem>
         </Form>
       </div>
     </div>
-    <Modal v-model="showKey"
-           :width="1250"
-           :mask-closable='false'
-           :closable='false'>
+    <Modal
+      v-model="showKey"
+      :width="1250"
+      :mask-closable="false"
+      :closable="false"
+    >
       <div>
-        <KeyBoard @cancel='successKey'
-                  @success='successKey'
-                  class='key-co' />
+        <KeyBoard @cancel="successKey" @success="successKey" class="key-co" />
       </div>
-      <div slot='footer'></div>
+      <div slot="footer"></div>
     </Modal>
   </div>
 </template>
 
 <script>
-import KeyBoard from '../../components/keyboard/index'
+import KeyBoard from "../../components/keyboard/index";
 export default {
-  data () {
+  data() {
     return {
       type: 1,
       info: {
-        m_id: '',
+        m_id: "",
         detail: [
           {
-            long: '',
-            width: '',
-            price: '',
-            stock: '',
-            warning_number: '',
-            scale: '',
-          }
-        ]
+            long: "",
+            width: "",
+            price: "",
+            stock: "",
+            warning_number: "",
+            scale: "",
+          },
+        ],
       },
       id: null,
       materialList: [],
       priceMathList: [
-        { label: '按米', value: 1 },
-        { label: '按数量', value: 2 },
+        { label: "按米", value: 1 },
+        { label: "按数量", value: 2 },
       ],
       showKey: false,
       itemRules: {
-        price: [
-          { required: true, message: ' ' }
-        ],
-        long: [
-          { required: true, message: ' ', trigger: 'blur' }
-        ],
-        width: [
-          { required: true, message: ' ', trigger: 'blur' }
-        ],
-        stock: [
-          { required: true, message: ' ' }
-        ],
-        scale: [
-          { required: true, message: ' ', }
-        ],
-        warning_number: [
-          { required: true, message: ' ', }
-        ],
+        price: [{ required: true, message: " " }],
+        long: [{ required: true, message: " ", trigger: "blur" }],
+        width: [{ required: true, message: " ", trigger: "blur" }],
+        stock: [{ required: true, message: " " }],
+        scale: [{ required: true, message: " " }],
+        warning_number: [{ required: true, message: " " }],
       },
       rules: {
-        title: [
-          { required: true, message: ' ', trigger: 'blur' }
-        ],
-        m_id: [
-          { required: true, message: ' ' }
-        ],
-        high: [
-          { required: true, message: ' ', trigger: 'blur' }
-        ],
-        unit: [
-          { required: true, message: ' ', trigger: 'blur' }
-        ],
+        title: [{ required: true, message: " ", trigger: "blur" }],
+        m_id: [{ required: true, message: " " }],
+        high: [{ required: true, message: " ", trigger: "blur" }],
+        unit: [{ required: true, message: " ", trigger: "blur" }],
       },
-      basic_type_id: '',
+      basic_type_id: "",
       isShowInfoMinStock: false,
       isShowInfoTopNumber: false,
       isShowInfoHigh: false,
@@ -253,29 +250,32 @@ export default {
       isShowDetailLong: false,
       isShowDetailWidth: false,
       isShowDetailCalc: false,
-      isShowDetailBtn: false
-    }
+      isShowDetailBtn: false,
+    };
   },
   components: { KeyBoard },
-  mounted () {
+  created() {},
+  mounted() {
     this.type = this.$route.query.type;
-    this.id = this.$route.query.id || ''
-    this.type == 1 ? this.info.m_id = this.$route.query.back_id * 1 : this.info.m_id;
-    this.axios('/api/basics_material_index').then(res => {
+    this.id = this.$route.query.id || "";
+    this.type == 1
+      ? (this.info.m_id = this.$route.query.back_id * 1)
+      : this.info.m_id;
+    this.axios("/api/basics_material_index").then((res) => {
       this.materialList = res.data.data;
-    })
+    });
     if (this.id) {
-      this.getData(this.id)
+      this.getData(this.id);
     }
     //根据基本类型展示不同字段
     setTimeout(() => {
-      let id = this.$route.query.back_id
-      let tempArr = this.$store.state.navgationData[9].sub
-      this.$store.state.navgationData.forEach(element => {
-        if (element.title == '物料档案') {
-          element.sub.forEach(elem => {
+      let id = this.$route.query.back_id;
+      let tempArr = this.$store.state.navgationData[9].sub;
+      this.$store.state.navgationData.forEach((element) => {
+        if (element.title == "物料档案") {
+          element.sub.forEach((elem) => {
             if (elem.id == id) {
-              this.basic_type_id = elem.sub_type_id
+              this.basic_type_id = elem.sub_type_id;
             }
           });
         }
@@ -290,72 +290,87 @@ export default {
         // 1木板 2木皮 3实木 4辅料 5五金 6油漆
         case 1:
         case 3:
-          this.isShowInfoHigh = true
-          this.isShowDetailLong = true
-          this.isShowDetailWidth = true
-          this.isShowDetail = true
-          this.isShowDetailBtn = true
+          this.isShowInfoHigh = true;
+          this.isShowDetailLong = true;
+          this.isShowDetailWidth = true;
+          this.isShowDetail = true;
+          this.isShowDetailBtn = true;
           break;
         case 2:
-          this.isShowInfoHigh = true
-          this.isShowInfoMinStock = true
-          this.isShowInfoTopNumber = true
-          this.isShowInfoPrice = true
-          break
+          this.isShowInfoHigh = true;
+          this.isShowInfoMinStock = true;
+          this.isShowInfoTopNumber = true;
+          this.isShowInfoPrice = true;
+          break;
         case 4:
         case 5:
         case 6:
-          this.isShowInfoMinStock = true
-          this.isShowInfoTopNumber = true
-          this.isShowInfoPrice = true
+          this.isShowInfoMinStock = true;
+          this.isShowInfoTopNumber = true;
+          this.isShowInfoPrice = true;
           break;
       }
     }, 500);
   },
   computed: {
-    setTip () {
-      const { type } = this.$route.query
-      const inner = type == 1 ? '新增物料' : (type == 2 ? '编辑物料' : (type == 3 ? '查看物料' : '拷贝物料'))
-      return inner
-    }
+    setTip() {
+      const { type } = this.$route.query;
+      const inner =
+        type == 1
+          ? "新增物料"
+          : type == 2
+          ? "编辑物料"
+          : type == 3
+          ? "查看物料"
+          : "拷贝物料";
+      return inner;
+    },
   },
   methods: {
-    getData (id) {
-      this.axios('/api/material', { params: { id: id } }).then(res => {
+    getData(id) {
+      this.axios("/api/material", { params: { id: id } }).then((res) => {
         let data = res.data.shift();
         this.info = data;
         if (this.info.detail.length < 1) {
-          this.info.detail = [{ long: '', width: '', price: '', stock: '', warning_number: '', scale: '', }]
+          this.info.detail = [
+            {
+              long: "",
+              width: "",
+              price: "",
+              stock: "",
+              warning_number: "",
+              scale: "",
+            },
+          ];
         }
-      })
+      });
     },
-    postData () {
-      const { type } = this.$route.query
-      this.info.op = (type == 1 || type == 4) ? 'add' : 'edit';
-      [2, 4, 5, 6].includes(this.basic_type_id) && (
-        this.info.detail[0].top_number = this.info.top_number,
-        this.info.detail[0].warning_number = this.info.warning_number,
-        this.info.detail[0].price = this.info.price
-      )
-      type == 4 ? this.info.id = '' : ''
-      this.axios.post('/api/material', this.info).then(res => {
+    postData() {
+      const { type } = this.$route.query;
+      this.info.op = type == 1 || type == 4 ? "add" : "edit";
+      [2, 4, 5, 6].includes(this.basic_type_id) &&
+        ((this.info.detail[0].top_number = this.info.top_number),
+        (this.info.detail[0].warning_number = this.info.warning_number),
+        (this.info.detail[0].price = this.info.price));
+      type == 4 ? (this.info.id = "") : "";
+      this.axios.post("/api/material", this.info).then((res) => {
         if (res.code == 200) {
-          this.$Message.success(res.msg)
-          this.back()
+          this.$Message.success(res.msg);
+          this.back();
         }
-      })
+      });
     },
-    back () {
-      this.$router.go(-1)
+    back() {
+      this.$router.go(-1);
     },
-    successKey (str) {
+    successKey(str) {
       this.info.formula = str;
       this.showKey = false;
     },
-    popKeyBoard () {
+    popKeyBoard() {
       this.showKey = true;
     },
-    async handleSubmit (name, itemName) {
+    async handleSubmit(name, itemName) {
       // const nameValue = await this.$refs[name].validate((valid)=>valid)
       // let result = []
       // for(let i = 0;i<this.$refs[itemName].length;i++){
@@ -365,17 +380,24 @@ export default {
       // }
       // const itemVal = result.every(val=>val)
       // if(nameValue&&itemVal){
-      this.postData()
+      this.postData();
       // }
     },
-    addMaterrial (row) {
-      row.push({ long: '', width: '', price: '', stock: '', warning_number: '', scale: '', })
+    addMaterrial(row) {
+      row.push({
+        long: "",
+        width: "",
+        price: "",
+        stock: "",
+        warning_number: "",
+        scale: "",
+      });
     },
-    removeChild (row, n) {
-      row.splice(n, 1)
-    }
-  }
-}
+    removeChild(row, n) {
+      row.splice(n, 1);
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>
@@ -386,4 +408,4 @@ export default {
   position: relative;
   margin: 20px 0;
 }
-</style>
+</style>

+ 73 - 30
src/views/OrderMannage/BusinessOrderlist/edit.vue

@@ -33,7 +33,7 @@
       >
         <FormItem
           v-if="formSetTableData.filter((v) => v.key == 'order_no')[0].is_show"
-          label="订单编号:"
+          :label="formSetTableData.filter((v) => v.key == 'order_no')[0].title"
         >
           <Input
             disabled
@@ -49,7 +49,9 @@
             formSetTableData.filter((v) => v.key == 'residential_name')[0]
               .is_show
           "
-          label="项目名称:"
+          :label="
+            formSetTableData.filter((v) => v.key == 'residential_name')[0].title
+          "
           prop="residential_name"
         >
           <Input
@@ -64,7 +66,9 @@
           v-if="
             formSetTableData.filter((v) => v.key == 'warning_state')[0].is_show
           "
-          label="紧急程度:"
+          :label="
+            formSetTableData.filter((v) => v.key == 'warning_state')[0].title
+          "
           prop="warning_state"
         >
           <Select
@@ -88,10 +92,12 @@
           }}</span>
         </FormItem>
         <FormItem
-          label="项目定金:"
           v-if="
             formSetTableData.filter((v) => v.key == 'front_money')[0].is_show
           "
+          :label="
+            formSetTableData.filter((v) => v.key == 'front_money')[0].title
+          "
         >
           <Input
             v-model="info.front_money"
@@ -105,7 +111,9 @@
           v-if="
             formSetTableData.filter((v) => v.key == 'start_time')[0].is_show
           "
-          label="开始日期:"
+          :label="
+            formSetTableData.filter((v) => v.key == 'start_time')[0].title
+          "
         >
           <DatePicker
             :options="options"
@@ -118,10 +126,12 @@
           <span v-else>{{ info.start_time }}</span>
         </FormItem>
         <FormItem
-          label="客户名称:"
           v-if="
             formSetTableData.filter((v) => v.key == 'client_name')[0].is_show
           "
+          :label="
+            formSetTableData.filter((v) => v.key == 'client_name')[0].title
+          "
           prop="custom_id"
         >
           <Select
@@ -146,11 +156,14 @@
           }}</span>
         </FormItem>
         <FormItem
-          label="负责人:"
           v-if="
             formSetTableData.filter((v) => v.key == 'custom_detail_name')[0]
               .is_show
           "
+          :label="
+            formSetTableData.filter((v) => v.key == 'custom_detail_name')[0]
+              .title
+          "
         >
           <Select
             placeholder="请选择负责人"
@@ -170,11 +183,14 @@
           <span v-else>{{ info.custom_detail_name }}</span>
         </FormItem>
         <FormItem
-          label="手机号:"
           v-if="
             formSetTableData.filter((v) => v.key == 'custom_detail_mobile')[0]
               .is_show
           "
+          :label="
+            formSetTableData.filter((v) => v.key == 'custom_detail_mobile')[0]
+              .title
+          "
         >
           <Select
             clearable
@@ -193,11 +209,13 @@
           <span v-else>{{ info.custom_detail_mobile }}</span>
         </FormItem>
         <FormItem
-          label="详细地址:"
           v-if="
             formSetTableData.filter((v) => v.key == 'custom_detail_id')[0]
               .is_show
           "
+          :label="
+            formSetTableData.filter((v) => v.key == 'custom_detail_id')[0].title
+          "
         >
           <Select
             clearable
@@ -217,10 +235,12 @@
           <span v-else>{{ info.custom_detail_id }}</span>
         </FormItem>
         <FormItem
-          label="专营业务员:"
           v-if="
             formSetTableData.filter((v) => v.key == 'service_id')[0].is_show
           "
+          :label="
+            formSetTableData.filter((v) => v.key == 'service_id')[0].title
+          "
         >
           <Select
             disabled
@@ -244,7 +264,7 @@
         </FormItem>
         <FormItem
           v-if="formSetTableData.filter((v) => v.key == 'end_time')[0].is_show"
-          label="交付日期:"
+          :label="formSetTableData.filter((v) => v.key == 'end_time')[0].title"
         >
           <DatePicker
             :options="options"
@@ -260,7 +280,9 @@
           v-if="
             formSetTableData.filter((v) => v.key == 'predict_price')[0].is_show
           "
-          label="产品总价:"
+          :label="
+            formSetTableData.filter((v) => v.key == 'predict_price')[0].title
+          "
         >
           <Input
             v-model="info.predict_price"
@@ -272,8 +294,8 @@
           <span v-else>{{ info.predict_price }}</span>
         </FormItem>
         <FormItem
-          label="折扣金额:"
           v-if="formSetTableData.filter((v) => v.key == 'fax_price')[0].is_show"
+          :label="formSetTableData.filter((v) => v.key == 'fax_price')[0].title"
         >
           <Input
             v-model="info.fax_price"
@@ -285,10 +307,10 @@
           <span v-else>{{ info.fax_price }}</span>
         </FormItem>
         <FormItem
-          label="订单金额:"
           v-if="
             formSetTableData.filter((v) => v.key == 'order_price')[0].is_show
           "
+          :label="formSetTableData.filter((v) => v.key == 'order_price')[0].title"
         >
           <Input
             v-model="info.order_price"
@@ -300,9 +322,9 @@
           <span v-else>{{ info.order_price }}</span>
         </FormItem>
         <FormItem
-          label="包装:"
           prop="box_id"
           v-if="formSetTableData.filter((v) => v.key == 'box_id')[0].is_show"
+          :label="formSetTableData.filter((v) => v.key == 'box_id')[0].title"
         >
           <Select
             clearable
@@ -326,8 +348,8 @@
           }}</span>
         </FormItem>
         <FormItem
-          label="订单备注:"
           v-if="formSetTableData.filter((v) => v.key == 'remark')[0].is_show"
+          :label="formSetTableData.filter((v) => v.key == 'remark')[0].title"
         >
           <Input
             v-model="info.remark"
@@ -2181,7 +2203,7 @@
         :max-height="600"
         border
         :columns="formSetTableColumns"
-        :data="formSetTableData"
+        :data="post_formSetTableData"
       >
       </Table>
       <!-- <CheckboxGroup v-model="forms_list">
@@ -2398,7 +2420,7 @@ export default {
           render: (h, params) => {
             const { index } = params;
             const currentRow = JSON.parse(
-              JSON.stringify(this.formSetTableData[index])
+              JSON.stringify(this.post_formSetTableData[index])
             );
             return h("Checkbox", {
               props: {
@@ -2420,7 +2442,11 @@ export default {
               on: {
                 "on-change": (e) => {
                   currentRow.is_show = e;
-                  this.formSetTableData.splice(index, 1, currentRow);
+                  this.post_formSetTableData.splice(index, 1, currentRow);
+                  console.log(
+                    "this.post_formSetTableData :>> ",
+                    this.post_formSetTableData
+                  );
                 },
               },
             });
@@ -2440,7 +2466,7 @@ export default {
           render: (h, params) => {
             const { index } = params;
             const currentRow = JSON.parse(
-              JSON.stringify(this.formSetTableData[index])
+              JSON.stringify(this.post_formSetTableData[index])
             );
             return h("Input", {
               props: {
@@ -2450,7 +2476,7 @@ export default {
               on: {
                 "on-change": (e) => {
                   currentRow.title = e.target.value;
-                  this.formSetTableData.splice(index, 1, currentRow);
+                  this.post_formSetTableData.splice(index, 1, currentRow);
                 },
               },
             });
@@ -2557,11 +2583,7 @@ export default {
   watch: {},
   created() {
     // 获取设置表单
-    this.axios
-      .post("/api/update/get_table", { id: "businessorderlist_detail" })
-      .then((res) => {
-        console.log("res :>> ", res);
-      });
+    this.get_forms();
     // 获取紧急程度
     this.axios.get("/api/warning_list").then((res) => {
       (this.warningList = res.data.data),
@@ -2623,6 +2645,24 @@ export default {
     });
   },
   methods: {
+    get_forms() {
+      this.axios
+        .post("/api/update/get_table", { id: "businessorderlist_detail" })
+        .then((res) => {
+          if (res.data.table.formSet && res.data.table.formSet.length > 0) {
+            this.formSetTableData = JSON.parse(
+              JSON.stringify(res.data.table.formSet)
+            );
+            this.post_formSetTableData = JSON.parse(
+              JSON.stringify(res.data.table.formSet)
+            );
+          } else {
+            this.post_formSetTableData = JSON.parse(
+              JSON.stringify(res.data.table.formSet)
+            );
+          }
+        });
+    },
     back() {
       // this.$router.go(-1);
       this.$router.push({
@@ -2630,7 +2670,7 @@ export default {
       });
     },
     postForms(n) {
-      this.formSetTableData.forEach((element, index) => {
+      this.post_formSetTableData.forEach((element, index) => {
         element.sort = index;
       });
       this.axios({
@@ -2639,12 +2679,15 @@ export default {
         data: {
           id: "businessorderlist_detail",
           result: {
-            formSet: this.formSetTableData,
+            formSet: this.post_formSetTableData,
           },
         },
       }).then((res) => {
-        this.$Message.success(res.msg);
-        this.initData(this.order_no);
+        if (res.code == 200) {
+          this.$Message.success(res.msg);
+          // this.initData(this.order_no);
+          this.get_forms();
+        }
       });
       // let result = [];
       // this.forms_list.map((rows) => {

+ 13 - 8
src/views/OrderMannage/BusinessOrderlist/list.vue

@@ -742,7 +742,12 @@ export default {
         },
         { is_show: true, key: "state", value: "订单状态", title: "订单状态" },
         { is_show: true, key: "crt_name", value: "制单人", title: "制单人" },
-        { is_show: true, key: "crt_time", value: "订单创建时间", title: "订单创建时间" },
+        {
+          is_show: true,
+          key: "crt_time",
+          value: "订单创建时间",
+          title: "订单创建时间",
+        },
         { is_show: true, key: "set", value: "操作", title: "操作" },
       ],
       sub_tableModalTableData: [],
@@ -968,15 +973,15 @@ export default {
     changePage(e) {
       this.page_index = e;
       this.proxyObj.page_index = this.page_index;
-      const temp = this.sortList.filter((item) => item.sort == null);
-      temp.length == 0 && (this.proxyObj.sortList = this.sortList);
+      const sortList = this.sortList.filter((item) => item.sort);
+      this.proxyObj.sortList = sortList;
       this.getData(this.proxyObj);
     },
     changeSize(e) {
       this.page_size = e;
       this.proxyObj.page_size = this.page_size;
-      const temp = this.sortList.filter((item) => item.sort == null);
-      temp.length == 0 && (this.proxyObj.sortList = this.sortList);
+      const sortList = this.sortList.filter((item) => item.sort);
+      this.proxyObj.sortList = sortList;
       this.getData(this.proxyObj);
     },
     addOrder(n, row) {
@@ -1017,7 +1022,7 @@ export default {
         });
     },
     openLower(row, title, url) {
-      console.log('row :>> ', row);
+      console.log("row :>> ", row);
       if (!row) {
         return this.$Message.warning("请至少选择一项");
       }
@@ -1025,14 +1030,14 @@ export default {
         ? row.join(",")
         : row.order_no;
       this.$Modal.confirm({
-        title: `确认下${title}?`,
+        title: "确认下生产?",
         content: "确认",
         onOk: () => {
           this.axios({
             method: "post",
             url,
             data: {
-              order_no:this.postInfo.order_no
+              order_no: this.postInfo.order_no,
             },
           }).then((res) => {
             if (res.code == 200) {

+ 12 - 7
src/views/ProcedureMannage/edit.vue

@@ -1,6 +1,8 @@
 <template>
   <div>
-    <Toptitle :title="type == 1 ? '新增工序' : '编辑工序'">
+    <Toptitle
+      :title="type == 1 ? '新增工序' : type == 2 ? '编辑工序' : '复制工序'"
+    >
       <Button @click="back" type="primary" ghost style="margin-right:10px;"
         >返回</Button
       >
@@ -10,7 +12,7 @@
     <div class="page-edit">
       <Form style="width:40%">
         <FormItem label="ID">
-          <Input v-model="info.id" disabled placeholder="自动生成"></Input>
+          <Input v-model="info.id" disabled placeholder="自动生成"/>
         </FormItem>
         <FormItem label="工序分类">
           <el-cascader
@@ -77,7 +79,7 @@ export default {
         capacity: "",
         wages: "",
         type: 1,
-        p_id: this.$route.query.id*1,
+        p_id: this.$route.query.id * 1,
         classify: this.$route.query.title || "",
       },
       employeeList: [],
@@ -95,14 +97,14 @@ export default {
     // basics_procedure_index
     this.axios.get("/api/basics_procedure_index").then((res) => {
       console.log(res);
-      this.cascader_list = res.data.data
+      this.cascader_list = res.data.data;
     });
   },
   mounted() {
     this.type = this.$route.query.type;
     this.id = this.$route.query.id;
     this.info.p_id = this.id * 1;
-    if (this.id && this.type == 2) {
+    if (this.id && (this.type == 2 || this.type == 3)) {
       this.getDetails(this.id);
     }
   },
@@ -113,8 +115,11 @@ export default {
     postData() {
       //保存时提交info
       let postUrl =
-        this.type == 1 ? "/api/procedure_add" : "/api/procedure_edit";
-      this.info.id = this.type == 1 ? this.id : this.info.id;
+        this.type == 1 || this.type == 3
+          ? "/api/procedure_add"
+          : "/api/procedure_edit";
+      this.info.id =
+        this.type == 1 ? this.id : this.type == 2 ? this.info.id : "";
       this.axios.post(postUrl, this.info).then((res) => {
         if (res.code == 200) {
           this.$Message.success(res.msg);

+ 171 - 118
src/views/ProcedureMannage/index.vue

@@ -1,89 +1,138 @@
 <template>
   <div>
-    <FullPage :title='$route.query.title'
-              :list='list'
-              @init='init'
-              :loading='loading'
-              @searchData='init'
-              @changePage='changePage'
-              @changeSize='changeSize'
-              :tableColums='tableColums'
-              :tableData='tableData'
-              :pageIndex='pageIndex'
-              :total='total'>
-      <div slot='titleButton'
-           style="display:flex">
-        <Upload v-if='persimissionData["批量导入"]||persimissionData.all'
-                name='your_file'
-                :show-upload-list='false'
-                :headers='headers'
-                :on-error='uploadError'
-                :on-success='uploadSuccess'
-                :action="$store.state.ip+'/api/procedure_index_import'">
-          <Button type="success"
-                  ghost
-                  icon='md-exit'
-                  style="margin-right:10px;">批量导入</Button>
+    <FullPage
+      :title="$route.query.title"
+      :list="list"
+      @init="init"
+      :loading="loading"
+      @searchData="init"
+      @changePage="changePage"
+      @changeSize="changeSize"
+      :tableColums="tableColums"
+      :tableData="tableData"
+      :pageIndex="pageIndex"
+      :total="total"
+    >
+      <div slot="titleButton" style="display:flex">
+        <Upload
+          v-if="persimissionData['批量导入'] || persimissionData.all"
+          name="your_file"
+          :show-upload-list="false"
+          :headers="headers"
+          :on-error="uploadError"
+          :on-success="uploadSuccess"
+          :action="$store.state.ip + '/api/procedure_index_import'"
+        >
+          <Button type="success" ghost icon="md-exit" style="margin-right:10px;"
+            >批量导入</Button
+          >
         </Upload>
-        <Button v-if='persimissionData["批量导出"]||persimissionData.all'
-                @click="exportData"
-                type="warning"
-                ghost
-                icon='md-return-left'
-                style="margin-right:10px;">批量导出</Button>
-        <Button v-if='persimissionData["新增工序"]||persimissionData.all'
-                type="primary"
-                ghost
-                icon='md-add'
-                @click="goPage(1)">新增工序</Button>
-
-      </div>
-      <div slot='navButton'>
+        <Button
+          v-if="persimissionData['批量导出'] || persimissionData.all"
+          @click="exportData"
+          type="warning"
+          ghost
+          icon="md-return-left"
+          style="margin-right:10px;"
+          >批量导出</Button
+        >
+        <Button
+          v-if="persimissionData['新增工序'] || persimissionData.all"
+          type="primary"
+          ghost
+          icon="md-add"
+          @click="goPage(1)"
+          >新增工序</Button
+        >
       </div>
-
-      <template slot='set'
-                slot-scope='{row}'>
+      <div slot="navButton"></div>
+      <template slot="set" slot-scope="{ row }">
         <div class="table-set">
-          <svg v-if='persimissionData["编辑"]||persimissionData.all'
-               style="font-size:20px"
-               color='#3764FF'
-               @click="goPage(2,row)"
-               class="icon icon-nav"
-               aria-hidden="true">
+            <!-- v-if="persimissionData['复制'] || persimissionData.all" -->
+          <svg
+            style="font-size:20px"
+            color="#3764FF"
+            @click="goPage(3, row)"
+            class="icon icon-nav"
+            aria-hidden="true"
+          >
+            <use xlink:href="#iconcopy-01"></use>
+          </svg>
+          <svg
+            v-if="persimissionData['编辑'] || persimissionData.all"
+            style="font-size:20px"
+            color="#3764FF"
+            @click="goPage(2, row)"
+            class="icon icon-nav"
+            aria-hidden="true"
+          >
             <use xlink:href="#iconbianji"></use>
           </svg>
 
-          <svg v-if='persimissionData["删除"]||persimissionData.all'
-               @click="delItems(row)"
-               class="icon icon-nav"
-               style="font-size:20px"
-               color='red'
-               aria-hidden="true">
+          <svg
+            v-if="persimissionData['删除'] || persimissionData.all"
+            @click="delItems(row)"
+            class="icon icon-nav"
+            style="font-size:20px"
+            color="red"
+            aria-hidden="true"
+          >
             <use xlink:href="#iconshanchu"></use>
           </svg>
         </div>
       </template>
     </FullPage>
-
   </div>
 </template>
 
 <script>
-import { mapState } from 'vuex'
+import { mapState } from "vuex";
 export default {
-  data () {
+  beforeRouteLeave(to, from, next) {
+    if (to.path == "/cms/proceduremannage/edit") {
+      this.$route.meta.keepAlive = true;
+    } else {
+      this.$route.meta.keepAlive = false;
+    }
+    next();
+  },
+  beforeRouteEnter(to, from, next) {
+    next((vm) => {
+      vm.getData(vm.proxyObj);
+    });
+  },
+  data() {
     return {
       list: [
-        { title: '工序名称', name: 'Input', value: '', serverName: 'title', placeholder: '请输入工序名称' },
+        {
+          title: "工序名称",
+          name: "Input",
+          value: "",
+          serverName: "title",
+          placeholder: "请输入工序名称",
+        },
       ],
       tableColums: [
-        { title: '序号', type: 'index', align: 'center', key: 'id', width: '100', fixed: 'left' },
-        { title: '工序类型', align: 'center', key: 'p_title', minWidth: 100 },
-        { title: '工序名称', align: 'center', key: 'title', minWidth: 100 },
-        { title: '工时', align: 'center', key: 'time', minWidth: 100 },
-        { title: '工价', align: 'center', key: 'wages', minWidth: 100 },
-        { title: '产能', align: 'center', key: 'capacity', minWidth: 100 },
-        { title: '操作', align: 'center', slot: 'set', width: '150', fixed: 'right' },
+        {
+          title: "序号",
+          type: "index",
+          align: "center",
+          key: "id",
+          width: "100",
+          fixed: "left",
+        },
+        { title: "工序类型", align: "center", key: "p_title", minWidth: 100 },
+        { title: "工序名称", align: "center", key: "title", minWidth: 100 },
+        { title: "工时", align: "center", key: "time", minWidth: 100 },
+        { title: "工价", align: "center", key: "wages", minWidth: 100 },
+        { title: "产能", align: "center", key: "capacity", minWidth: 100 },
+        {
+          title: "操作",
+          align: "center",
+          slot: "set",
+          width: "150",
+          fixed: "right",
+        },
       ],
       tableData: [],
       pageIndex: 1,
@@ -95,101 +144,105 @@ export default {
       proxyObj: {},
       id: null,
       loading: false,
-      headers: { 'Authorization': localStorage.getItem('token') },
-    }
+      headers: { Authorization: localStorage.getItem("token") },
+    };
   },
   watch: {
-    $route (to) {
+    $route(to) {
       this.id = to.query.id;
-      this.proxyObj.id = this.id
-      this.list.forEach(element => {
-        element.value = ''
+      this.proxyObj.id = this.id;
+      this.list.forEach((element) => {
+        element.value = "";
       });
-      this.proxyObj.title = ''
-      this.getData(this.proxyObj)
-    }
+      this.proxyObj.title = "";
+      this.getData(this.proxyObj);
+    },
   },
   computed: {
-    ...mapState(['persimissionData']),
+    ...mapState(["persimissionData"]),
   },
-  mounted () {
+  mounted() {
     if (this.$route.query.id) {
-      this.id = this.$route.query.id
+      this.id = this.$route.query.id;
       this.proxyObj.id = this.id;
-      this.getData(this.proxyObj)
+      this.getData(this.proxyObj);
     }
   },
   methods: {
-    init (row) {
-      this.pageIndex = 1
+    init(row) {
+      this.pageIndex = 1;
       row.page_index = this.pageIndex;
       row.page_size = this.pageSize;
-      this.proxyObj = row
+      this.proxyObj = row;
       this.proxyObj.id = this.id;
-      this.getData(row)
+      this.getData(row);
     },
-    getData (row) {
+    getData(row) {
       this.loading = true;
-      this.axios('/api/procedure_index', { params: row }).then(res => {
+      this.axios("/api/procedure_index", { params: row }).then((res) => {
         this.loading = false;
         this.tableData = res.data.data;
         this.total = res.data.total;
-      })
+      });
     },
-    changePage (e) {
+    changePage(e) {
       this.pageIndex = e;
       this.proxyObj.page_index = this.pageIndex;
-      this.getData(this.proxyObj)
+      this.getData(this.proxyObj);
     },
-    changeSize (e) {
+    changeSize(e) {
       this.pageSize = e;
       this.proxyObj.page_size = this.pageSize;
-      this.getData(this.proxyObj)
+      this.getData(this.proxyObj);
     },
-    goPage (n, row) {
-      let id = row ? row.id : this.id
+    goPage(n, row) {
+      let id = row ? row.id : this.id;
       this.$router.push({
-        path: '/cms/proceduremannage/edit',
+        path: "/cms/proceduremannage/edit",
         query: {
           type: n,
           id: id,
-          title: this.$route.query.title
-        }
-      })
+          title: this.$route.query.title,
+        },
+      });
     },
-    delItems (row) {
+    delItems(row) {
       this.confirmDelete({
-        content: '确认删除么?',
+        content: "确认删除么?",
         then: () => {
-          this.axios.post('/api/procedure_del', { id: row.id, state: 0 }).then(res => {
-            if (res.code == 200) {
-              this.$Message.success(res.msg)
-              this.getData(this.proxyObj)
-            }
-          })
-        }
-      })
+          this.axios
+            .post("/api/procedure_del", { id: row.id, state: 0 })
+            .then((res) => {
+              if (res.code == 200) {
+                this.$Message.success(res.msg);
+                this.getData(this.proxyObj);
+              }
+            });
+        },
+      });
     },
-    async exportData () {
-      const res = await this.axios('/api/procedure_index_export', { params: { ...this.proxyObj } })
+    async exportData() {
+      const res = await this.axios("/api/procedure_index_export", {
+        params: { ...this.proxyObj },
+      });
       if (res.code == 200) {
-        let url = `${this.$store.state.ip}/api/storage/${res.data.file}`
-        location.href = url
+        let url = `${this.$store.state.ip}/api/storage/${res.data.file}`;
+        location.href = url;
       }
     },
-    uploadSuccess (res) {
+    uploadSuccess(res) {
       if (res.code == 200) {
-        this.$Message.success(res.msg || '上传成功')
+        this.$Message.success(res.msg || "上传成功");
       } else {
-        this.$Message.warning(res.msg || '上传失败')
+        this.$Message.warning(res.msg || "上传失败");
       }
-      this.getData(this.proxyObj)
+      this.getData(this.proxyObj);
     },
-    uploadError (err) {
-      this.$Message.error(err.msg || '上传失败')
-    }
-  }
-}
+    uploadError(err) {
+      this.$Message.error(err.msg || "上传失败");
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>
@@ -198,4 +251,4 @@ export default {
   justify-content: space-between;
   align-items: center;
 }
-</style>
+</style>

+ 72 - 50
src/views/ProcessLine/index.vue

@@ -54,8 +54,15 @@
       class-name="vertical-center-modal"
       width="80%"
       v-model="showModal"
+      :mask-closable="false"
       :title="
-        isAdd ? '工艺路线新增' : isCheck ? '工艺路线详情' : '工艺路线编辑'
+        isAdd
+          ? '工艺路线新增'
+          : isCheck
+          ? '工艺路线详情'
+          : isCopy
+          ? '工艺路线复制'
+          : '工艺路线编辑'
       "
     >
       <div class="modal_process_route">
@@ -99,16 +106,23 @@
               class="SortableItem"
               :index="key"
             >
-              <div class="tag-modal">
-                <div class="before">{{ key + 1 }}</div>
-                <Tag
-                  @on-close="closeTag(key, selectTags, item)"
-                  color="primary"
-                  type="border"
-                  closable
-                  >{{ item.title }}</Tag
-                >
-              </div>
+              <Tooltip>
+                <div slot="content">
+                  <p>工时:{{ item.time }}</p>
+                  <p>工价:{{ item.wages }}</p>
+                  <p>产能:{{ item.capacity }}</p>
+                </div>
+                <div class="tag-modal">
+                  <div class="before">{{ key + 1 }}</div>
+                  <Tag
+                    @on-close="closeTag(key, selectTags, item)"
+                    color="primary"
+                    type="border"
+                    closable
+                    >{{ item.title }}</Tag
+                  >
+                </div>
+              </Tooltip>
             </SlickItem>
           </SlickList>
         </div>
@@ -116,11 +130,17 @@
           <div v-for="(item, index) of info.bps" :key="index">
             <div v-if="item.cld && item.cld.length > 0">
               <span style="font-weight:bold">{{ item.title }}</span>
-              <div>
+              <div
+                style="display: flex;justify-content: flex-start;flex-wrap: wrap;"
+              >
                 <div
                   v-for="(_item, _index) in item.cld"
                   :key="_index"
-                  style="margin-left:10px"
+                  :style="
+                    _item.p_id
+                      ? [{ 'margin-left': '10px' }]
+                      : [{ 'margin-left': '10px' }, { width: '100%' }]
+                  "
                 >
                   <div v-if="_item.cld && _item.cld.length > 0">
                     <div>
@@ -133,7 +153,11 @@
                         <div
                           v-for="(__item, __index) in _item.cld"
                           :key="__index"
-                          style="margin-left:10px"
+                          :style="
+                            __item.p_id
+                              ? [{ 'margin-left': '10px' }]
+                              : [{ 'margin-left': '10px' }, { width: '100%' }]
+                          "
                         >
                           <div v-if="__item.cld && __item.cld.length > 0">
                             <span style="font-weight:bold"
@@ -279,6 +303,7 @@ export default {
       },
       isCheck: false,
       isAdd: false,
+      isCopy: false,
     };
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
@@ -365,28 +390,28 @@ export default {
               const e = el.cld[k];
               if (e.id == element) {
                 e.show = true;
-                this.selectTags.push(e);
+                e.p_id && this.selectTags.push(e);
               }
               e.cld &&
                 e.cld.length > 0 &&
                 e.cld.forEach((z) => {
                   if (z.id == element) {
                     z.show = true;
-                    this.selectTags.push(z);
+                    z.p_id && this.selectTags.push(z);
                   }
                   z.cld &&
                     z.cld.length > 0 &&
                     z.cld.forEach((elem) => {
                       if (elem.id == element) {
                         elem.show = true;
-                        this.selectTags.push(elem);
+                        elem.p_id && this.selectTags.push(elem);
                       }
                       elem.cld &&
                         elem.cld.length > 0 &&
                         elem.cld.forEach((ele) => {
                           if (ele.id == element) {
                             ele.show = true;
-                            this.selectTags.push(ele);
+                            ele.p_id && this.selectTags.push(ele);
                           }
                         });
                     });
@@ -394,20 +419,11 @@ export default {
             }
           }
         });
+        this.isCopy = false;
         switch (type) {
           case 1:
-            this.axios({
-              method: "post",
-              url: "/api/technological_route_edit",
-              data: {
-                title: row.title + "副本",
-                procedure_id: this.info.procedure_id,
-              },
-            }).then((res) => {
-              if (res.code == 200) {
-                this.init(this.proxyObj);
-              }
-            });
+            this.showModal = true;
+            this.isCopy = true;
             break;
           case 2:
             this.showModal = true;
@@ -428,13 +444,13 @@ export default {
                   data: {
                     id: row.id,
                   },
-                })
-                  .then((res) => {
+                }).then((res) => {
+                  if (res.code == 200) {
                     this.$Message.success(res.msg);
-                    this.getData(this.proxyObj);
                     this.showModal = false;
-                  })
-                  .catch((err) => {});
+                    this.getData(this.proxyObj);
+                  }
+                });
               },
               onCancel: () => (this.showModal = false),
             });
@@ -452,9 +468,15 @@ export default {
     getData(row) {
       this.loading = true;
       this.axios("/api/technological_route", { params: row }).then((res) => {
-        this.loading = false;
-        this.tableData = res.data.data;
-        this.total = res.data.total;
+        if (res.code == 200) {
+          if (res.data.data.length == 0) {
+            this.proxyObj.page_index--;
+            this.getData(this.proxyObj);
+          }
+          this.loading = false;
+          this.tableData = res.data.data;
+          this.total = res.data.total;
+        }
       });
     },
     getChangeLists(e) {},
@@ -468,21 +490,21 @@ export default {
         method: "post",
         url: "/api/technological_route_edit",
         data: {
-          id: this.info.id,
+          id: this.isCopy ? "" : this.info.id,
           title: this.info.title,
           procedure_id: temparr.join(","),
         },
-      })
-        .then((res) => {
+      }).then((res) => {
+        if (res.code == 200) {
           this.$Message.success(res.msg);
           this.init(this.proxyObj);
-        })
-        .catch((err) => {});
+          this.showModal = false;
+        }
+      });
     },
     closeTag(key, arr, row) {
       //取消tag标签展示操作并同步下方的复选框ui同步
-      if (this.isCheck) {
-      } else {
+      if (!this.isCheck) {
         for (const key in this.info.bps) {
           const element = this.info.bps[key];
           element.cld.map((p) => {
@@ -495,17 +517,17 @@ export default {
                   q.cld.length > 0 &&
                   q.cld.map((r) => {
                     r.id == row.id ? (r.show = false) : "";
+                    r.cld &&
+                      r.cld.length > 0 &&
+                      r.cld.map((s) => {
+                        s.id == row.id ? (s.show = false) : "";
+                      });
                   });
               });
           });
         }
         arr.splice(key, 1);
         return;
-        this.info.bps.map((v) => {
-          v.cld.map((p) => {
-            p.id == row.id ? (p.show = false) : "";
-          });
-        });
       }
     },
     changeCheck(e, item, selectArray) {

+ 175 - 46
src/views/ProcessRoute/edit.vue

@@ -83,6 +83,7 @@
     <Modal
       class-name="vertical-center-modal"
       v-model="show_add"
+      :mask-closable="false"
       title="选择工艺路线"
     >
       <div class="modal_process_route">
@@ -120,9 +121,32 @@
     <Modal
       class-name="vertical-center-modal"
       width="80%"
+      :mask-closable="false"
       v-model="show_add_detail"
-      title="工艺路线"
+      title="工艺路线详情"
     >
+      <div class="modal_process_route_detail">
+        <div>
+          <span style="width: 100px">id: </span
+          ><Input
+            v-model="info.id"
+            disabled
+            placeholder="自动生成"
+            style="width: 150px"
+            size="small"
+          />
+        </div>
+        <div>
+          <span style="width: 100px">工艺路线名称: </span
+          ><Input
+            v-model="info.title"
+            placeholder="请输入工艺路线名称"
+            @on-change="handleProcessNameChange"
+            size="small"
+            style="width: 250px"
+          />
+        </div>
+      </div>
       <div class="modal_content">
         <div class="modal_content_left">
           <span>已选:</span>
@@ -142,16 +166,23 @@
               class="SortableItem"
               :index="key"
             >
-              <div class="tag-modal">
-                <div class="before">{{ key + 1 }}</div>
-                <Tag
-                  @on-close="closeTag(key, selectTags, item)"
-                  color="primary"
-                  type="border"
-                  closable
-                  >{{ item.title }}</Tag
-                >
-              </div>
+              <Tooltip>
+                <div slot="content">
+                  <p>工时:{{ item.time }}</p>
+                  <p>工价:{{ item.wages }}</p>
+                  <p>产能:{{ item.capacity }}</p>
+                </div>
+                <div class="tag-modal">
+                  <div class="before">{{ key + 1 }}</div>
+                  <Tag
+                    @on-close="closeTag(key, selectTags, item)"
+                    color="primary"
+                    type="border"
+                    closable
+                    >{{ item.title }}</Tag
+                  >
+                </div>
+              </Tooltip>
             </SlickItem>
           </SlickList>
         </div>
@@ -159,11 +190,17 @@
           <div v-for="(item, index) of info.bps" :key="index">
             <div v-if="item.cld && item.cld.length > 0">
               <span style="font-weight:bold">{{ item.title }}</span>
-              <div>
+              <div
+                style="display: flex;justify-content: flex-start;flex-wrap: wrap;"
+              >
                 <div
                   v-for="(_item, _index) in item.cld"
                   :key="_index"
-                  style="margin-left:10px"
+                  :style="
+                    _item.p_id
+                      ? [{ 'margin-left': '10px' }]
+                      : [{ 'margin-left': '10px' }, { width: '100%' }]
+                  "
                 >
                   <div v-if="_item.cld && _item.cld.length > 0">
                     <div>
@@ -176,7 +213,11 @@
                         <div
                           v-for="(__item, __index) in _item.cld"
                           :key="__index"
-                          style="margin-left:10px"
+                          :style="
+                            __item.p_id
+                              ? [{ 'margin-left': '10px' }]
+                              : [{ 'margin-left': '10px' }, { width: '100%' }]
+                          "
                         >
                           <div v-if="__item.cld && __item.cld.length > 0">
                             <span style="font-weight:bold"
@@ -313,6 +354,8 @@ export default {
       processRouteId: "",
       processRouteName: "",
       process_name: "",
+      isNewProcess: false,
+      temp_info_bps: [],
     };
   },
   computed: {
@@ -335,10 +378,11 @@ export default {
     if (this.id) {
       this.getData(this.id);
     }
+    this.axios("/api/bp_list").then((res) => {
+      this.info.bps = res.data;
+      this.temp_info_bps = res.data;
+    });
     if (this.type == 1) {
-      this.axios("/api/bp_list").then((res) => {
-        this.info.bps = res.data;
-      });
       this.axios("/api/bpp_list_new").then((res) => {
         res.data.map((v) => {
           if (v.select) {
@@ -359,9 +403,9 @@ export default {
   methods: {
     handleProcessLineSet(row, index) {
       this.info.id = row.id;
-      this.process_name = row.title;
-      // this.info.title = row.title;
+      this.info.title = row.title;
       this.info.procedure_id = row.procedure_id;
+      this.isNewProcess = false;
       this.selectTags = [];
       const arr = this.info.procedure_id
         ? this.info.procedure_id.split(",")
@@ -371,13 +415,41 @@ export default {
         element.cld.forEach((z) => {
           z.show = arr.includes(z.id + "");
           if (arr.includes(z.id + "")) {
-            this.selectTags.push(z);
+            z.p_id && this.selectTags.push(z);
           }
+          z.cld &&
+            z.cld.length > 0 &&
+            z.cld.forEach((elem) => {
+              elem.show = arr.includes(elem.id + "");
+              if (arr.includes(elem.id + "")) {
+                elem.p_id && this.selectTags.push(elem);
+              }
+              elem.cld &&
+                elem.cld.length > 0 &&
+                elem.cld.forEach((ele) => {
+                  ele.show = arr.includes(ele.id + "");
+                  if (arr.includes(ele.id + "")) {
+                    ele.p_id && this.selectTags.push(ele);
+                  }
+                  ele.cld &&
+                    ele.cld.length > 0 &&
+                    ele.cld.forEach((el) => {
+                      el.show = arr.includes(el.id + "");
+                      if (arr.includes(el.id + "")) {
+                        el.p_id && this.selectTags.push(el);
+                      }
+                    });
+                });
+            });
         });
       }
       this.show_add_detail = true;
       this.show_add = false;
     },
+    handleProcessNameChange(val) {
+      this.process_name = val;
+      this.isNewProcess = true;
+    },
     handleSearchProcessLine(title) {
       this.axios({
         method: "get",
@@ -431,28 +503,31 @@ export default {
       this.axios("/api/process_route_detail", { params: { id: row } }).then(
         (res) => {
           this.info = res.data;
+          this.info.bps = this.temp_info_bps;
           this.selectTags = res.data.produce_list;
           const selectTagsId = this.selectTags.map((item) => item.id);
           this.info.bps.forEach((v) => {
-            v.cld.forEach((z) => {
-              z.show = selectTagsId.includes(z.id);
-            });
+            v.cld &&
+              v.cld.length > 0 &&
+              v.cld.forEach((z) => {
+                z.show = selectTagsId.includes(z.id);
+                z.cld &&
+                  z.cld.length > 0 &&
+                  z.cld.forEach((elem) => {
+                    elem.show = selectTagsId.includes(elem.id);
+                    elem.cld &&
+                      elem.cld.length > 0 &&
+                      elem.cld.forEach((ele) => {
+                        ele.show = selectTagsId.includes(ele.id);
+                        ele.cld &&
+                          ele.cld.length > 0 &&
+                          ele.cld.forEach((el) => {
+                            el.show = selectTagsId.includes(el.id);
+                          });
+                      });
+                  });
+              });
           });
-          // this.info.bps.map(v=>{
-          //     if(v.select&&v.select.length>0){
-          //         v.cld.map(z=>{
-          //             v.select.map(k=>{
-          //                 if(!z.show){
-          //                     z.show = k == z.id ? true : false
-          //                     z.show ? this.selectTags.push(z) : ''
-          //                 }
-
-          //             })
-          //         })
-          //     }else{
-          //         v.cld.map(v=>v.show = false)
-          //     }
-          // })
           this.process_name = res.data.technological_route_title;
           this.tableData = JSON.parse(JSON.stringify(this.selectTags));
         }
@@ -468,6 +543,7 @@ export default {
       this.handleSearchProcessLine(this.tempProcessLine.title);
     },
     changeCheck(e, item, selectArray) {
+      this.isNewProcess = true;
       //复选框选中与非选中同时同步tag标签跟随操作
       item.show = e;
       if (e) {
@@ -478,20 +554,67 @@ export default {
         selectArray.splice(id_index, 1);
       }
     },
+    // closeTag(key, arr, row) {
+    //   //取消tag标签展示操作并同步下方的复选框ui同步
+    //   arr.splice(key, 1);
+    //   console.log(this.info);
+    //   this.info.bps.map((v) => {
+    //     v.cld.map((p) => {
+    //       p.id == row.id ? (p.show = false) : "";
+    //       console.log(p);
+    //     });
+    //   });
+    // },
     closeTag(key, arr, row) {
       //取消tag标签展示操作并同步下方的复选框ui同步
-      arr.splice(key, 1);
-      console.log(this.info);
-      this.info.bps.map((v) => {
-        v.cld.map((p) => {
+      for (const key in this.info.bps) {
+        const element = this.info.bps[key];
+        element.cld.map((p) => {
           p.id == row.id ? (p.show = false) : "";
-          console.log(p);
+          p.cld &&
+            p.cld.length > 0 &&
+            p.cld.map((q) => {
+              q.id == row.id ? (q.show = false) : "";
+              q.cld &&
+                q.cld.length > 0 &&
+                q.cld.map((r) => {
+                  r.id == row.id ? (r.show = false) : "";
+                  r.cld &&
+                    r.cld.length > 0 &&
+                    r.cld.map((s) => {
+                      s.id == row.id ? (s.show = false) : "";
+                    });
+                });
+            });
         });
-      });
+      }
+      arr.splice(key, 1);
     },
     saveTableData() {
-      this.tableData = JSON.parse(JSON.stringify(this.selectTags));
-      this.show_add_detail = false;
+      if (this.isNewProcess) {
+        let temparr = [];
+        this.selectTags.forEach((el) => {
+          temparr.push(el.id);
+        });
+        this.axios({
+          method: "post",
+          url: "/api/technological_route_edit",
+          data: {
+            id: "",
+            title: this.info.title,
+            procedure_id: temparr.join(","),
+          },
+        }).then((res) => {
+          if (res.code == 200) {
+            // this.$Message.success(res.msg);
+            this.show_add_detail = false;
+          }
+        });
+      } else {
+        this.tableData = JSON.parse(JSON.stringify(this.selectTags));
+        this.process_name = this.info.title;
+        this.show_add_detail = false;
+      }
     },
     handleSubmit(name) {
       this.$refs[name].validate((valid) => {
@@ -659,4 +782,10 @@ export default {
     font-size: 18px;
   }
 }
+.modal_process_route_detail {
+  display: flex;
+  justify-content: space-around;
+  align-items: center;
+  margin: 5px 0;
+}
 </style>

+ 8 - 6
src/views/ProcessRoute/index.vue

@@ -229,6 +229,10 @@ export default {
     getData(row) {
       this.loading = true;
       this.axios("/api/process_route_index", { params: row }).then((res) => {
+        if (res.data.detail.length == 0) {
+          this.proxyObj.page_index--;
+          this.getData(this.proxyObj);
+        }
         this.loading = false;
         res.data.top.map((v, i) => {
           if (v.key == "颜色") {
@@ -289,17 +293,15 @@ export default {
     changePage(e) {
       this.pageIndex = e;
       this.proxyObj.page_index = this.pageIndex;
-      this.sortList &&
-        this.sortList.length > 0 &&
-        (this.proxyObj.sortList = this.sortList);
+      const sortList = this.sortList.filter((item) => item.sort);
+      this.proxyObj.sortList = sortList;
       this.getData(this.proxyObj);
     },
     changeSize(e) {
       this.pageSize = e;
       this.proxyObj.page_size = this.pageSize;
-      this.sortList &&
-        this.sortList.length > 0 &&
-        (this.proxyObj.sortList = this.sortList);
+      const sortList = this.sortList.filter((item) => item.sort);
+      this.proxyObj.sortList = sortList;
       this.getData(this.proxyObj);
     },
     goPage(n, row) {

+ 4 - 6
src/views/ProductMannage/index.vue

@@ -692,17 +692,15 @@ export default {
     changePage(e) {
       this.pageIndex = e;
       this.proxyObj.page_index = this.pageIndex;
-      this.sortList &&
-        this.sortList.length > 0 &&
-        (this.proxyObj.sortList = this.sortList);
+      const sortList = this.sortList.filter((item) => item.sort);
+      this.proxyObj.sortList = sortList;
       this.getData(this.proxyObj);
     },
     changeSize(e) {
       this.pageSize = e;
       this.proxyObj.page_size = this.pageSize;
-      this.sortList &&
-        this.sortList.length > 0 &&
-        (this.proxyObj.sortList = this.sortList);
+      const sortList = this.sortList.filter((item) => item.sort);
+      this.proxyObj.sortList = sortList;
       this.getData(this.proxyObj);
     },
     goPage(n, row) {

+ 1 - 1
vue.config.js

@@ -2,7 +2,7 @@ const axios_default_ip =
     process.env.NODE_ENV == 'dev' ?
     'http://121.41.102.225:82' :
     process.env.NODE_ENV == 'test-prd' ?
-    'http://124.71.176.88:882' //测试服
+    'http://121.41.102.225:82' //测试服
     :
     process.env.NODE_ENV == 'prd_other' ?
     'http://121.37.173.82:82' //森兰九鼎