Andy 3 yıl önce
ebeveyn
işleme
7e17b39162
1 değiştirilmiş dosya ile 259 ekleme ve 157 silme
  1. 259 157
      src/views/ProductionOrderList/Dispatchlist/confirm.vue

+ 259 - 157
src/views/ProductionOrderList/Dispatchlist/confirm.vue

@@ -1,176 +1,278 @@
 <template>
-    <div>
-        <FullPage 
-        title='派工单详情列表' 
-        :list='list'
-        @init='init'
-        @searchData='init' 
-        :logList='logList'
-        @selectTable='selectTable'
-        @changePage='changePage'
-        @changeSize='changeSize'
-        :tableColums='tableColums'
-        :tableData='tableData'
-        :pageIndex='pageIndex'
-        :pageSize='pageSize'
-        :total='total'
-        >   
-            <div slot='titleButton'>
-                <Button @click="back" style="margin-right:10px;">返回</Button>
-                <Button @click="finish(selectIds,1)" type="success"  ghost>批量完成</Button>
-            </div>
+  <div>
+    <FullPage
+      title="派工单详情列表"
+      :list="list"
+      @init="init"
+      @searchData="init"
+      :logList="logList"
+      @selectTable="selectTable"
+      @changePage="changePage"
+      @changeSize="changeSize"
+      :tableColums="tableColums"
+      :tableData="tableData"
+      :pageIndex="pageIndex"
+      :pageSize="pageSize"
+      :total="total"
+    >
+      <div slot="titleButton">
+        <Button @click="back" style="margin-right:10px;">返回</Button>
+        <Button @click="finish(selectIds, 1)" type="success" ghost
+          >批量完成</Button
+        >
+      </div>
 
-            <template slot='set' slot-scope='{row}'>
-                <div>
-                    <a class="map-margin" @click="goOriginalPage(row)">原材料预算</a>
-                    <a v-if="row.state != 3" class="map-margin" style="color:#32C800" @click="finish(row,1)">完成</a>
-                    <a class="map-margin"  @click="goDetial(row,1)">查看详情</a>
-                </div>
-            </template>
-        </FullPage>
-    </div>
+      <template slot="set" slot-scope="{ row }">
+        <div>
+          <a class="map-margin" @click="goOriginalPage(row)">原材料预算</a>
+          <a
+            v-if="row.state != 3"
+            class="map-margin"
+            style="color:#32C800"
+            @click="finish(row, 1)"
+            >完成</a
+          >
+          <a class="map-margin" @click="goDetial(row, 1)">查看详情</a>
+        </div>
+      </template>
+    </FullPage>
+  </div>
 </template>
 
 <script>
 export default {
-    data(){
-        return {
-            type:1,
-            logList:[{title:'系统单号',value:'10998765'}],
-            tableColums:[
-                {type:'selection',fixed:'left',width:'90',align:'center'},
-                {title:'工序分类',align:'center',minWidth:150,key:'basic_title'},
-                {title:'工序',align:'center',minWidth:150,key:'procedure_title'},
-                {title:'班组信息',align:'center',minWidth:150,key:'username'},
-                {title:'完工状态',align:'center',minWidth:100,
-                    render:(h,params)=>h('span',{},params.row.state == 3 ? '已完工' : '未完工')
-                },
-                {title:'完工百分比',align:'center',minWidth:120,
-                    render(h,params){
-                        return h('span',{},parseInt(params.row.complete_rate*100)+'%')
-                    },
-                },
-                {title:'派工时间',align:'center',minWidth:200,
-                    render:(h,params)=>h('span',{},this.func.replaceDate(params.row.produce_time*1))
-                },
-                {title:'操作',align:'center',slot:'set',fixed:'right',width:'250'},
-            ],
-            tableData:[{residential_name:'dlaskdsad',state:0,id:99}],
-            pageIndex:1,
-            pageSize:10,
-            total:0,
-            selectIds:[],
-            proxyObj:{order_no:this.$route.query.order_no},
-            produces:[],
-            users:[],
-        }
-    },
-    created(){
-        this.axios('/api/procedure_index').then(res=>this.produces = res.data.data)
-        this.axios('/api/employee_list').then(res=>this.users = res.data)
-    },
-    computed:{
-        list(){
-            const array = [
-                {title:'工序',filterable:true,name:'Select',value:'',serverName:'produce_id',optionName:'title',optionValue:'id',option:this.produces},
-                {title:'班组信息',filterable:true,name:'Select',value:'',optionName:'nickname',optionValue:'id',serverName:'user_id',option:this.users},
-                {title:'完工状态',name:'Select',value:'',serverName:'produce',option:[
-                    {label:'未完工',value:1},
-                    {label:'已完工',value:3},
-                ]},
-                {title:'派工时间',name:'Input',start_server:'start_time',end_server:'end_time',start_value:'',end_value:'',isDate:true,serverName:'id2',start_placeholder:'开始日期',end_placeholder:'结束日期'},
-            ]
-            return array
-        }
-    },
-    methods:{
-        init(row){
-            this.pageIndex = 1
-            row.page_size = this.pageSize
-            row.page_index = this.pageIndex
-            Object.assign(row,this.$route.query)
-            this.getData(row)
+  data() {
+    return {
+      type: 1,
+      logList: [{ title: "系统单号", value: "10998765" }],
+      tableColums: [
+        { type: "selection", fixed: "left", width: "90", align: "center" },
+        {
+          title: "工序分类",
+          align: "center",
+          minWidth: 150,
+          key: "basic_title",
         },
-        back(){
-            this.$router.go(-1)
+        {
+          title: "工序",
+          align: "center",
+          minWidth: 150,
+          key: "procedure_title",
         },
-        getData(row){
-            row.page_size = this.pageSize
-            row.page_index = this.pageIndex
-            this.axios('/api/orders_dispatch_produce_list',{params:row}).then(res=>{
-                if(res.code == 200){
-                    this.tableData = res.data.list;
-                    this.logList = res.data.detail;
-                    this.total = res.data.total
-                }
-            })
+        { title: "班组信息", align: "center", minWidth: 150, key: "username" },
+        {
+          title: "完工状态",
+          align: "center",
+          minWidth: 100,
+          render: (h, params) =>
+            h("span", {}, params.row.state == 3 ? "已完工" : "未完工"),
         },
-        postData(data,type){
-            let url = type == 1 ? '/api/orders_dispatch_confirm' : '/api/orders_plan_cancer'
-            this.axios.post(url,data).then(res=>{
-                if(res.code == 200){
-                    this.$Message.success(res.msg);
-                    this.getData(this.$route.query)
-                }
-            })
+        {
+          title: "完工百分比",
+          align: "center",
+          minWidth: 120,
+          render(h, params) {
+            return h(
+              "span",
+              {},
+              parseInt(params.row.complete_rate * 100) + "%"
+            );
+          },
         },
-        finish(row,type){
-            if(!row||row.length<1){return this.$Message.warning('请至少选择一项')}
-            let params = {
-                order_no:Array.isArray(row) ? row.reduce((pre,cur,n)=>`${pre}${cur.order_no}${n==row.length-1 ? '' : ','}`,'') : row.order_no,
-                produce_id:Array.isArray(row) ? row.reduce((pre,cur,n)=>`${pre}${cur.produce_id}${n==row.length-1 ? '' : ','}`,'') : row.produce_id,
-                produce_time:Array.isArray(row) ? row.reduce((pre,cur,n)=>`${pre}${cur.produce_time}${n==row.length-1 ? '' : ','}`,'') : row.produce_time,
-            }
-            this.confirmDelete({
-                content:'是否手动操作此订单生产完成',
-                title:'生产完成',
-                type:'primary',
-                then:()=>{
-                    this.postData(params,type)
-                },
-                cancel:()=>{}
-            })
+        {
+          title: "派工时间",
+          align: "center",
+          minWidth: 200,
+          render: (h, params) =>
+            h("span", {}, this.func.replaceDate(params.row.produce_time * 1)),
         },
-        selectTable(e){
-            this.selectIds = e;
+        {
+          title: "操作",
+          align: "center",
+          slot: "set",
+          fixed: "right",
+          width: "250",
         },
-        changePage(e){
-            this.pageIndex = e;
-            this.proxyObj.page_index = this.pageIndex;
-            this.getData(this.proxyObj)
+      ],
+      tableData: [{ residential_name: "dlaskdsad", state: 0, id: 99 }],
+      pageIndex: 1,
+      pageSize: 10,
+      total: 0,
+      selectIds: [],
+      proxyObj: { order_no: this.$route.query.order_no },
+      produces: [],
+      users: [],
+    };
+  },
+  created() {
+    this.axios("/api/procedure_index").then(
+      (res) => (this.produces = res.data.data)
+    );
+    this.axios("/api/employee_list").then((res) => (this.users = res.data));
+  },
+  computed: {
+    list() {
+      const array = [
+        {
+          title: "工序",
+          filterable: true,
+          name: "Select",
+          value: "",
+          serverName: "produce_id",
+          optionName: "title",
+          optionValue: "id",
+          option: this.produces,
         },
-        changeSize(e){
-            this.pageSize = e;
-            this.proxyObj.page_size = this.page_size;
-            this.getData(this.proxyObj)
+        {
+          title: "班组信息",
+          filterable: true,
+          name: "Select",
+          value: "",
+          optionName: "nickname",
+          optionValue: "id",
+          serverName: "user_id",
+          option: this.users,
         },
-        goDetial(row){
-            this.$router.push({
-                path:'/cms/productionorderlist/dispatchlist/details',
-                query:{
-                    order_no:this.$route.query.order_no,
-                    produce_id:row.produce_id,
-                    produce_time:row.produce_time
-                }
-            })
+        {
+          title: "完工状态",
+          name: "Select",
+          value: "",
+          serverName: "produce",
+          option: [
+            { label: "未完工", value: 1 },
+            { label: "已完工", value: 3 },
+          ],
         },
-        goOriginalPage(row){
-            this.$router.push({
-                path:'/cms/rawmateria/index',
-                query:{
-                    order_no:row.order_no,
-                    type:9,
-                    residential_name:row.residential_name,
-                    produce_id:row.produce_id,
-                    produce_time:row.produce_time
-
-                }
-            })
+        {
+          title: "派工时间",
+          name: "Input",
+          start_server: "start_time",
+          end_server: "end_time",
+          start_value: "",
+          end_value: "",
+          isDate: true,
+          serverName: "id2",
+          start_placeholder: "开始日期",
+          end_placeholder: "结束日期",
         },
-    }
-}
+      ];
+      return array;
+    },
+  },
+  methods: {
+    init(row) {
+      this.pageIndex = 1;
+      row.page_size = this.pageSize;
+      row.page_index = this.pageIndex;
+      Object.assign(row, this.$route.query);
+      this.getData(row);
+    },
+    back() {
+      this.$router.go(-1);
+    },
+    getData(row) {
+      row.page_size = this.pageSize;
+      row.page_index = this.pageIndex;
+      this.axios("/api/orders_dispatch_produce_list", { params: row }).then(
+        (res) => {
+          if (res.code == 200) {
+            this.tableData = res.data.list;
+            this.logList = res.data.detail;
+            this.total = res.data.total;
+          }
+        }
+      );
+    },
+    postData(data, type) {
+      let url =
+        type == 1 ? "/api/orders_dispatch_confirm" : "/api/orders_plan_cancer";
+      this.axios.post(url, data).then((res) => {
+        if (res.code == 200) {
+          this.$Message.success(res.msg);
+          this.getData(this.$route.query);
+        }
+      });
+    },
+    finish(row, type) {
+      if (!row || row.length < 1) {
+        return this.$Message.warning("请至少选择一项");
+      }
+      let params = {
+        order_no: Array.isArray(row)
+          ? row.reduce(
+              (pre, cur, n) =>
+                `${pre}${cur.order_no}${n == row.length - 1 ? "" : ","}`,
+              ""
+            )
+          : row.order_no,
+        produce_id: Array.isArray(row)
+          ? row.reduce(
+              (pre, cur, n) =>
+                `${pre}${cur.produce_id}${n == row.length - 1 ? "" : ","}`,
+              ""
+            )
+          : row.produce_id,
+        produce_time: Array.isArray(row)
+          ? row.reduce(
+              (pre, cur, n) =>
+                `${pre}${cur.produce_time}${n == row.length - 1 ? "" : ","}`,
+              ""
+            )
+          : row.produce_time,
+      };
+      this.confirmDelete({
+        content: "是否手动操作此订单生产完成",
+        title: "生产完成",
+        type: "primary",
+        then: () => {
+          this.postData(params, type);
+        },
+        cancel: () => {},
+      });
+    },
+    selectTable(e) {
+      this.selectIds = e;
+    },
+    changePage(e) {
+      this.pageIndex = e;
+      this.proxyObj.page_index = this.pageIndex;
+      this.getData(this.proxyObj);
+    },
+    changeSize(e) {
+      this.pageSize = e;
+      this.proxyObj.page_size = this.page_size;
+      this.getData(this.proxyObj);
+    },
+    goDetial(row) {
+      this.$router.push({
+        path: "/cms/productionorderlist/dispatchlist/details",
+        query: {
+          order_no: this.$route.query.order_no,
+          produce_id: row.produce_id,
+          produce_time: row.produce_time,
+        },
+      });
+    },
+    goOriginalPage(row) {
+      this.$router.push({
+        path: "/cms/rawmateria/index",
+        query: {
+          order_no: row.order_no,
+          type: 9,
+          residential_name: row.residential_name,
+          produce_id: row.produce_id,
+          produce_time: row.produce_time,
+        },
+      });
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>
-.log-list{display: flex;flex-wrap:wrap;padding:10px 0;}
-</style>
+.log-list {
+  display: flex;
+  flex-wrap: wrap;
+  padding: 10px 0;
+}
+</style>