mushencc 3 gadi atpakaļ
vecāks
revīzija
4c1c1b7f69

BIN
dist (2).zip


BIN
dist.zip


+ 78 - 27
src/components/selects/reference/index.vue

@@ -10,7 +10,7 @@
                  @searchData="init">
 
       </Topsearch>
-      <Table @on-select="selectTableProject"
+      <Table @on-selection-change="selectTableProject"
              :max-height="maxHeight"
              stripe
              border
@@ -40,7 +40,11 @@
              v-if="type!=9"
              v-show="type!=14"
              :columns="parts_tableColumns"
-             :data="parts_tableData"></Table>
+             :data="parts_tableData">
+             <template slot="purchases_num" slot-scope="{index}">
+               <Input v-model="parts_tableData[index].purchases_num" ></Input>
+             </template>
+             </Table>
       <vxe-table resizable
                  border
                  size="mini"
@@ -151,11 +155,17 @@ export default {
     set_list () {
       switch (this.type) {
         case 1:
-          return [//参照请购单
-            { title: '订单号', name: 'Input', value: '', placeholder: '请输入订单号', serverName: 'purchase_order_apply_no' },
-            { title: '请购类型', name: 'Select', value: '', placeholder: '请选择请购类型', serverName: 'type_id', option: this.purchaseTypeList },
-            { title: '项目名称', name: 'Input', value: '', placeholder: '请输入项目名称', serverName: 'title', },
-            { title: '制单时间', start_server: 'start_time', end_server: 'end_time', name: 'Input', start_value: '', end_value: '', isDate: true, start_placeholder: '开始日期', end_placeholder: '结束日期', },
+          return [//参照采购计划
+            { title: '计划单号', name: 'Select', value: '', placeholder: '请选择计划单号', serverName: 'purchase_order_apply_no' },
+            { title: '采购计划类型', name: 'Select', value: '', placeholder: '请选择采购计划类型', serverName: 'type_id', option: this.purchaseTypeList },
+           
+            { title: '单据日期', start_server: 'start_time', end_server: 'end_time', name: 'Input', start_value: '', end_value: '', isDate: true, start_placeholder: '开始日期', end_placeholder: '结束日期', },
+             { title: '物料分类', name: 'Select', value: '', placeholder: '请选择采购计划类型', serverName: 'type_id', option: this.purchaseTypeList },
+             { title: '物料名称', name: 'Select', value: '', placeholder: '请选择采购计划类型', serverName: 'type_id', option: this.purchaseTypeList },
+             { title: '项目编码', name: 'Select', value: '', placeholder: '请选择采购计划类型', serverName: 'type_id', option: this.purchaseTypeList },
+              { title: '项目名称', name: 'Select', value: '', placeholder: '请选择采购计划类型', serverName: 'type_id', option: this.purchaseTypeList },
+                { title: '建议供应商', name: 'Select', value: '', placeholder: '请选择采购计划类型', serverName: 'type_id', option: this.purchaseTypeList },
+               { title: '单据日期', start_server: 'start_time', end_server: 'end_time', name: 'Input', start_value: '', end_value: '', isDate: true, start_placeholder: '开始日期', end_placeholder: '结束日期', },
           ]
         case 2:
         case 3:
@@ -185,6 +195,10 @@ export default {
           return [//采购参照请购单
             { title: '物料分类', name: 'Select', value: '', placeholder: '请选择物料分类', serverName: 'type_id', option: this.materialTypeList },
             { title: '物料名称', name: 'Input', value: '', placeholder: '请输入物料名称', serverName: 'title' },
+            {title: '项目编码',name:'Select',value:'',placeholder:'请选择项目编码',serverName:'project_code',option:[]},
+            {title: '项目名称',name:'Select',value:'',placeholder:'请选择项目编码',serverName:'project_code',option:[]},
+            {title: '建议供应商',name:'Select',value:'',placeholder:'请选择项目编码',serverName:'project_code',option:[]},
+             { title: '预计到货时间', start_server: 'start_time', end_server: 'end_time', name: 'Input', start_value: '', end_value: '', isDate: true, start_placeholder: '开始日期', end_placeholder: '结束日期', }
           ]
         case 2:
         case 3:
@@ -223,23 +237,24 @@ export default {
 
     }).catch((err) => { });
     switch (this.type) {
-      case 1: //采购单参照请购单
+      case 1: //采购订单参照采购计划
         this.project_tableColumns = [
           { title: '选择', align: 'center', minWidth: 100, type: 'selection' },
           // { title: '订单号', align: 'center', key: 'purchase_order_apply_no', minWidth: 200, },
-          { title: '订单号', align: 'center', key: 'purchase_order_apply_no', minWidth: 200, },
-          { title: '请购类型', align: 'center', key: 'type_title', minWidth: 150, },
-          { title: '项目名称', align: 'center', key: 'residential_name', minWidth: 150 },
+          { title: '计划单号', align: 'center', key: 'plan_no', minWidth: 200, },
+          { title: '采购计划类型', align: 'center', key: 'plan_type_title', minWidth: 150, },
+         
           {
-            title: '单日期', align: 'center', key: 'crt_time', minWidth: 200,
+            title: '单日期', align: 'center', key: 'crt_time', minWidth: 200,
             render: (h, params) =>
-              h('span', this.func.replaceDate(params.row.crt_time * 1)),
+              h('span', params.row.order_time?this.func.replaceDate(params.row.order_time * 1).split(' ')[0]:''),
           },
+           { title: '备注', align: 'center', key: 'remark', minWidth: 150 }
         ]
         this.parts_tableColumns = [
           { type: 'selection', align: 'center', minWidth: 100, fixed: 'left' },
-          { title: '物料分类', key: 'type_title', align: 'center', minWidth: 150 },
-          { title: '物料名称', key: 'title', align: 'center', minWidth: 150 },
+          { title: '物料分类', key: 'material_type', align: 'center', minWidth: 150 },
+          { title: '物料名称', key: 'material_title', align: 'center', minWidth: 150 },
           {
             title: '物料规格', key: '', align: 'center', minWidth: 150,
             render: (h, params) => {
@@ -249,10 +264,31 @@ export default {
             }
           },
           { title: '计量单位', key: 'unit', align: 'center', minWidth: 150 },
-          { title: '请购数量', key: 'num', align: 'center', minWidth: 150 },
+          { title: '项目编码', key: 'project_code', align: 'center', minWidth: 150 },
+           { title: '项目名称', key: 'project_title', align: 'center', minWidth: 150 },
+          { title: '计划数量', key: 'num', align: 'center', minWidth: 150,
+          render:(h,params)=>{
+            const {row} = params;
+            return h("span",{},row.num-row.reference_num)
+          } },
+           { title: '采购数量', key: 'purchases_num', align: 'center', minWidth: 150,slot:'purchases_num'
+          //  render:(h,params,index)=>{
+          //    console.log(index)
+          //    return h("Input",{props:{value:params.row.purchases_num},on:{'on-change':(e)=>{
+          //      console.log(index);
+          //     //  this.parts_tableData[index].purchases_num=e.target.value;
+          //      console.log(this.parts_tableData)}}})
+          //  }
+           },
+            { title: '预计到货时间', key: 'arrived_time', align: 'center', minWidth: 150,
+            render:(h,params)=>{
+              const {row}=params;
+              return h('span',{},row.arrive_time?this.func.replaceDate(row.arrive_time*1).split(' ')[0]:'')
+            } },
+             { title: '建议供应商', key: 'supply_title', align: 'center', minWidth: 150 },
         ]
         this.get_project_url = '/api/purchase_apply_list'
-        this.get_child_url = '/api/purchase_refer_apply'
+        this.get_child_url = '/api/purchase_apply_detail'
         this.childrenParams = {}
         break
       case 2: //到货单参照采购单
@@ -537,9 +573,16 @@ export default {
     this.axios({ method: 'get', url: '/api/basic_purchase_list', }).then((res) => {
       this.purchaseTypeList = res.data.data
       this.purchaseTypeList.forEach(element => {
-        element.value = element.type_id
+        element.value = element.id
         element.label = element.title
       })
+      if(this.type == 1){
+        this.purchaseTypeList.map((v,index)=>{
+          if(v.type_id !== 1){
+               this.purchaseTypeList.splice(index,1)
+          }
+        })
+      }
     }).catch((err) => { });
     this.$nextTick((e) => {
       const clientTableHeight = window.innerHeight - 51 - 57 -
@@ -549,6 +592,7 @@ export default {
     })
   },
   methods: {
+   
     selectChangeEvent ({ records }) {
       this.tableResult = JSON.parse(JSON.stringify(records))
     },
@@ -613,6 +657,7 @@ export default {
     getData (params) {
       params.end_time = Date.parse(params.end_time).toString().slice(0,10)
       params.start_time = Date.parse(params.start_time).toString().slice(0,10)
+      params.reference_type =1;
       if(params.end_time == 'NaN'){
         params.end_time = ''
       }
@@ -689,21 +734,27 @@ export default {
         }
       });
     },
-    selectTableProject (selection, row) {
+    selectTableProject (selection) {
       switch (this.type) {
         case 1://采购单参照请购单
-          this.currencyOrder = row.purchase_order_apply_no
+        console.log(selection);
+          // this.currencyOrder = row.plan_no
+          let plan_no = [];
+          selection.forEach(v=>{
+             plan_no.push(v.plan_no)
+          })
           this.axios({
-            method: 'get',
+            method: 'post',
             url: this.get_child_url,
-            params: {
-              purchase_order_apply_no: row.purchase_order_apply_no
+            data: {
+             plan_no
             }
           }).then((res) => {
-            res.data.forEach(element => {
-              element.residential_name = row.residential_name
-            });
-            this.parts_tableData = [...this.parts_tableData, ...res.data]
+            res.data.children.forEach(element => {
+              // element.residential_name = row.residential_name;
+              element.purchases_num = 0;
+            })
+            this.parts_tableData = res.data.children;
           }).catch((err) => { });
           break;
         case 2://到货单参照采购单

+ 10 - 0
src/routerMap/index.js

@@ -1202,6 +1202,16 @@ const routerMap = [
       require(["@/views/Dispatching/Dispatching"], resolve),
   },
   {
+    path: "/cms/BasicSettings/rootManage",
+    name: "rootManage", // 设置-->设置-->工序班组权限表
+    meta: {
+      index: 3,
+    },
+    component: (resolve) =>
+      require(["@/views/BasicSettings/rootManage"], resolve),
+  },
+  
+  {
     path: "/cms/Dispatching/DispatchingDetail",
     name: "DispatchingDetail", // 分类派工→派工详情
     meta: {

+ 2 - 2
src/views/BasicSettings/ClassifyDocs/TypeDocs.vue

@@ -93,8 +93,8 @@ export default {
       ],
       tableData: [{}],
       typeList: [
-        { id: 1, title: '请购' },
-        { id: 2, title: '采购' },
+        { id: 1, title: '采购计划' },
+        { id: 2, title: '采购订单' },
         { id: 3, title: '出库' },
         { id: 4, title: '入库' },
       ],

+ 9 - 1
src/views/BasicSettings/copy_Setting.vue

@@ -7,7 +7,7 @@
 
            <Input slot="title" v-if="item.title_type" @on-blur="change_title(item,1)" v-model="item.title" :autofocus='true' style="width:80%"></Input>
           <p slot="title" v-else @click="change_title(item)">{{item.title}}</p>
-          <a @click="upload(item)" class="upload_pic">保存</a>
+          <a @click="upload(item)" class="upload_pic" v-if="item.content[0].sub_state!==4">保存</a>
 
           <div class="card_content">
             <div :title="_item.title" v-for="(_item,_index) in item.content" :key="_index" >
@@ -59,6 +59,14 @@
                   />
                 </div>
               </div>
+
+
+            
+
+          <!-- 跳转页面 -->
+          <div v-if="_item.sub_state == 4" style="text-align:center;display: flex;flex-direction: column;align-items: center;margin-top:30px">
+            <Button type="primary" size='large' @click="$router.push(_item.value)">{{_item.title}}</Button>
+          </div>
             </div>
           </div>
             <Tooltip max-width="200" :content="item.remark" 

+ 357 - 0
src/views/BasicSettings/rootManage.vue

@@ -0,0 +1,357 @@
+<template>
+  <div>
+    <Toptitle :title="title">
+      <slot name="titleButton">
+        <!-- <Button @click="back"
+                type='primary'
+                ghost
+                style="margin-right:10px;">返回</Button> -->
+        <Button type="primary"
+                style="margin-right:10px;"
+                @click="handleRowClick({},null,1)"
+                ghost>新增</Button>
+      </slot>
+    </Toptitle>
+    <div style="padding-top:20px">
+      <Form inline :label-width='50'>
+        <FormItem label="用户:">
+          <Input style="width:150px"
+                 clearable
+                 v-model="search_title"
+                 size="small"
+                 placeholder="请输入用户" />
+        </FormItem>
+        <FormItem>
+          <Button type="primary"
+                  size="small"
+                  @click="init">搜索</Button>
+        </FormItem>
+      </Form>
+    </div>
+    <div style="padding:20px 0px">
+      <Table border
+             ref="refTableData"
+             draggable
+             :columns="columns"
+             :data="tableData"
+             @on-drag-drop="onDragDrop">
+        <template slot="process"
+                  slot-scope="{row}">
+        <span>{{row.process.toString()}}</span>
+        </template>
+         <template slot="band"
+                  slot-scope="{row}">
+        <span>{{row.band.toString()}}</span>
+        </template>
+        <template slot="op"
+                  slot-scope="{row,index}">
+                 
+             <a @click="handleRowClick(row,index,4)"
+             style="margin-right:10px">编辑</a>      
+          <a @click="handleRowClick(row,index,2)"
+             style="margin-right:10px">查看</a>
+          <a @click="handleRowClick(row,index,3)">删除</a>
+        </template>
+      </Table>
+    </div>
+    <Modal class="modal"
+           :title='modal_title'
+           v-model='showModal'
+           :mask-closable="false"
+           :width="400">
+      <div>
+        <span>用户:</span> 
+        
+          <Select style="width:50%" v-model="currencyRow.id" filterable clearable v-if="modal_title !== '查看'">
+              <Option v-for="(item,index) in user_list" :key="index" :label="item.nickname" :value="item.id">
+              </Option>
+          </Select>
+          <span v-else>{{currencyRow.user}}</span>
+      </div>
+      <div>
+        <span>工序:</span>
+        
+          <Select style="width:50%" v-model="currencyRow.produce_ids" filterable multiple v-if="modal_title !== '查看'">
+              <Option v-for="(item,index) in process_list" :key="index" :label="item.title" :value="item.id">
+              </Option>
+          </Select>
+           <span v-else>{{currencyRow.process.toString()}}</span>
+      </div>
+      <div>
+        <span>班组:</span>
+        
+          <Select style="width:50%" v-model="currencyRow.employee_ids" filterable multiple v-if="modal_title !== '查看'">
+              <Option v-for="(item,index) in band_list" :key="index" :label="item.nickname" :value="item.id">
+              </Option>
+          </Select>
+           <span v-else>{{currencyRow.band.toString()}}</span>
+      </div>
+      <div class="modal-footer"
+           slot="footer">
+        <Button @click="showModal = false">取消</Button>
+        <Button type="primary"
+                @click="handleColorConfirm">确认</Button>
+      </div>
+    </Modal>
+  </div>
+</template>
+
+<script>
+// 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
+// 例如:import 《组件名称》 from '《组件路径》';
+
+export default {
+  components: {
+
+  },
+  props: {},
+  // import引入的组件需要注入到对象中才能使用
+  data () {
+    // 这里存放数据
+    return {
+        process_list:[],
+        band_list:[],
+        user_list:[],
+        search_title:'',
+        modal_title:'',
+      title: '工序班组权限表',
+      columns: [
+        { title:'ID', key: 'sub_id', align: 'center' },
+        { title: '用户', key: 'user', align: 'center', },
+        { title: '工序', key: 'process', align: 'center', 
+          render:(h,params)=>{
+          return h('div',[
+            h('span',{
+              style:{
+                display:"inline-block",
+                width:'100%',
+                overflow:'none',
+                textOverflow:'ellipsis',
+                whiteSpace:"nowrap",
+                cursor: 'pointer'
+              },
+              domProps:{title:params.row.process.toString()},
+              // on:{'click':(e)=>{e.stopPropagation();console.log(1)}}
+            },params.row.process.toString())
+          ])
+        }},
+        { title: '班组', key: 'band', align: 'center',
+           render:(h,params)=>{
+          return h('div',[
+            h('span',{
+              style:{
+                display:"inline-block",
+                width:'100%',
+                overflow:'none',
+                textOverflow:'ellipsis',
+                whiteSpace:"nowrap",
+                cursor: 'pointer'
+              },
+              domProps:{title:params.row.band.toString()},
+              // on:{'click':(e)=>{e.stopPropagation();console.log(1)}}
+            },params.row.band.toString())
+          ])
+        } 
+        },
+        { title: '操作', key: 'operation', align: 'center', slot: 'op' }
+      ],
+      tableData: [],
+      maxSort: 0,
+      showModal: false,
+      //1新增2编辑
+      addState: 0,
+      currencyRow: {
+        id:'',
+        produce_ids :[],
+        employee_ids:[]
+      },
+      currencyIndex: 0
+    }
+  },
+  // 生命周期 - 创建完成(可以访问当前this实例)
+  created () {
+    // this.initData()
+  
+    //用户列表
+    this.axios.get('/api/user').then(res=>{this.user_list = res.data.data});
+    //工序列表
+    this.axios.post('/api/ext_produce_list').then(res=>{this.process_list = res.data});
+    //班组列表
+    this.axios("/api/employee_list").then((res) => (this.band_list = res.data));
+  },
+  // 生命周期 - 挂载完成(可以访问DOM元素)
+  mounted () {  
+      this.init()
+  },
+  methods: {
+    init () {
+    //   this.$forceUpdate();
+      this.axios.post('/api/ext_user_permission_list', 
+         {
+          title: this.search_title
+        }
+      ).then(res => {
+        if (res.code == 200) {
+            res.data.data.map(v=>{
+                v.process =[];
+                v.band =[];
+            })
+          
+          this.tableData = res.data.data;
+          
+          this.tableData.forEach(m=>{
+           
+         this.user_list.forEach(v=>{
+                   
+                  if(m.sub_id == v.id){
+                      m.user = v.nickname 
+                  }
+         })
+      m.json.produce_ids.forEach(x=>{
+              this.process_list.forEach(z=>{
+                  if(x==z.id){
+                      m.process.push(z.title);
+                  }
+              })
+          })
+        m.json.employee_ids.forEach(s=>{
+           
+            this.band_list.forEach(c=>{
+
+                if(s==c.id){
+                   
+                    m.band.push(c.nickname)
+                    
+                }
+            })
+        })
+          })
+        }
+          console.log(this.tableData)
+      }).catch(err => {  })
+    },
+    back () {
+      this.$router.go(-1)
+    },
+    handleRowClick (row, index, type) {
+//1新增 2查看 3删除 4编辑
+      this.currencyIndex = index
+      this.addState = type
+   
+      switch (type) {
+        case 1:
+            this.modal_title = '新增';
+            
+            this.currencyRow = {
+        id:'',
+        produce_ids :[],
+        employee_ids:[]
+      }
+      this.showModal = true;
+            break;
+        case 2:
+            this.modal_title ='查看';
+            this.currencyRow.user = row.user;
+            this.currencyRow.band = row.band;
+            this.currencyRow.process = row.process;
+          this.showModal = true;
+
+          break;
+        case 3:
+          this.$Modal.confirm({
+            title: '确认删除?',
+            content: '此操作确认后无法恢复,请确认此操作!',
+            onOk: () => {
+              this.axios({
+                method: 'post',
+                url: '/api/ext_user_permission_del',
+                data: {
+                  id: row.sub_id
+                }
+              }).then((res) => {
+                this.$Message.success(res.msg)
+                this.init()
+              }).catch((err) => { });
+            },
+            onCancel: () => { }
+          })
+          break;
+          case 4:
+            this.modal_title = '编辑';
+           
+           this.currencyRow.id = row.sub_id;
+
+           this.currencyRow.produce_ids = row.json.produce_ids;
+            this.currencyRow.employee_ids = row.json.employee_ids;
+             this.showModal = true;
+      }
+    },
+    handleColorChange (row, index, type) {
+      this.addState = type
+      this.showModal = true
+    },
+    handleColorConfirm () {
+      this.axios({
+        method: 'post',
+        url: '/api/ext_user_permission_edit',
+        data: {
+          ...this.currencyRow
+        }
+      }).then((res) => {
+        this.$Message.success(res.msg)
+        this.showModal = false
+        this.init()
+      }).catch((err) => { });
+    },
+    handleSave () {
+      this.tableData.forEach((el, index) => {
+        el.sort = index + 1
+      });
+      this.axios({
+        method: 'post',
+        url: '/api/basics_color_edit',
+        data: {
+          ...this.tableData
+        }
+      }).then((res) => {
+        this.$Message.success(res.msg)
+        this.showModal = false
+        // this.init()
+      }).catch((err) => { });
+    },
+    onDragDrop (a, b) {
+      this.tableData.splice(b, 0, ...this.tableData.splice(a, 1))
+    }
+  },
+  // 监听属性 类似于data概念
+  computed: {},
+  // 监控data中的数据变化
+  watch: {},
+  beforeCreate () { }, // 生命周期 - 创建之前
+  beforeMount () { }, // 生命周期 - 挂载之前
+  beforeUpdate () { }, // 生命周期 - 更新之前
+  updated () { }, // 生命周期 - 更新之后
+  beforeDestroy () { }, // 生命周期 - 销毁之前
+  destroyed () { }, // 生命周期 - 销毁完成
+  activated () { }, // 如果页面有keep-alive缓存功能,这个函数会触发
+}
+</script>
+
+<style lang='scss' scoped>
+.modal {
+  div {
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    padding: 10px 0;
+    span{
+       
+       
+    }
+  }
+}
+/deep/ .ivu-select-selection{
+    width: 300px;
+  
+}
+</style>

+ 16 - 2
src/views/Dispatching/Dispatching.vue

@@ -36,7 +36,7 @@
           </Select>
         </FormItem>
         <FormItem>
-          <Button  type="primary" @click="initData">搜索</Button>
+          <Button  type="primary" @click="initDataSearch">搜索</Button>
         </FormItem>
       </Form>
       <div class="header">
@@ -202,6 +202,7 @@ export default {
       tableColumns: [
         { title: '全选', type: 'selection', align: 'center', minWidth: 60 },
         { title: "工序", align: "center", key: "title", minWidth: 150 },
+        { title: "图号", align: "center", key: "url_number", minWidth: 150 ,ellipsis:'true',tooltip:'true' },
         { title: "部件总数", align: "center", key: "num", minWidth: 150 },
         {
           title: "班组",
@@ -265,7 +266,8 @@ export default {
       dispatchInfo: {},
       subArr: [],
       subUrl: "",
-      show_type:true
+      show_type:true,
+      url_number_type:true,
     };
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
@@ -302,6 +304,15 @@ export default {
       })
   },
   methods: {
+  initDataSearch(){
+    if(this.searchData.residential_name&&this.searchData.order_no){
+      this.url_number_type = false;
+      this.initData();
+    }else{
+      this.url_number_type = true;
+      this.initData();
+    }
+  },
   async residentialNameChange(val){
        await this.axios.get('/api/order_produce_order_no',{params:{residential_name:val}}).then(res=>{
             this.searchData.order_no = res.data.order_no
@@ -461,6 +472,9 @@ export default {
           this.total = res.data.total;
           this.tableData = res.data.data;
           this.tableData.forEach((element) => {
+            if(this.url_number_type){
+              element.url_number = '';
+            }
             element.produce_id = element.id;
             element.employee_id ? "" : (element.employee_id = "");
             if(this.currencyTag == 1  ){

+ 27 - 0
src/views/ProductionOrderList/Deliverylist/Deliverylist.vue

@@ -155,6 +155,7 @@ import { mapState } from "vuex";
 export default {
   data() {
     return {
+      url_number_list:[],
       tableColums: [
         {
           title: "订单编号",
@@ -191,6 +192,14 @@ export default {
           minWidth: 200,
         },
         {
+          title: "图号",
+          align: "center",
+          key: "url_number",
+          minWidth: 200,
+          ellipsis:'true',
+          tooltip:'true'
+        },
+        {
           title: "出库时间",
           align: "center",
           key: "dispatch_time",
@@ -334,6 +343,17 @@ export default {
           serverName: "residential_name",
           placeholder: "项目名称",
           value: "",
+        }, 
+        {
+          title: "图号",
+          name: "Select",
+          filterable:'true',
+          serverName: "url_number",
+          placeholder: "请选择",
+          value: "",
+          optionName: "title",
+          optionValue: "title",
+          option: this.url_number_list,
         },
         // {
         //   title: "客户",
@@ -379,6 +399,13 @@ export default {
           this.tableData = res.data.data;
           this.total = res.data.total;
           this.tableheaders = res.data.tableSet || [];
+          let data =[];
+          res.data.url_number_list.map(v=>{
+            let obj={};
+            obj.title = v;
+            data.push(obj);
+          })
+          this.url_number_list = data;
         }
       });
     },

+ 19 - 1
src/views/ProductionOrderList/Dispatchlist/confirm.vue

@@ -87,6 +87,7 @@ export default {
             h("span", {}, params.row.rework_state == 1 ? "返工" : "正常"),
           
         },
+        { title: "图号", align: "center", minWidth: 150, key: "url_number" ,ellipsis:'true',tooltip:'true'},
         { title: "班组信息", align: "center", minWidth: 150, key: "username" },
         {
           title: "完工状态",
@@ -184,6 +185,16 @@ export default {
           option: this.users,
         },
         {
+          title: "图号",
+          filterable: true,
+          name: "Select",
+          value: "",
+          optionName: "title",
+          optionValue: "title",
+          serverName: "url_number",
+          option: this.url_number_list,
+        },
+        {
           title: "完工状态",
           name: "Select",
           value: "",
@@ -269,7 +280,14 @@ export default {
             this.total = res.data.total;
            this.produce_type_list =res.data.basic_title;
            this.produces = res.data.procedure_title;
-           this.users = res.data.username
+           this.users = res.data.username;
+           let data =[];
+           res.data.url_number_list.map(v=>{
+             let obj={};
+             obj.title = v;
+             data.push(obj)
+           })
+           this.url_number_list = data
           }
         }
       );

+ 16 - 3
src/views/ProductionOrderList/Dispatchlist/list.vue

@@ -77,7 +77,8 @@ export default {
 
         
         { title: '项目名称', align: 'center', key: 'residential_name', minWidth: 200 },
-        { title: '紧急程度', align: 'center', key: 'warning_state', minWidth: 100, slot: 'basicTypeSet', },
+        { title: '图号', align: 'center', key: 'url_number', minWidth: 200,ellipsis:'true',tooltip:'true' },
+        { title: '紧急程度', align: 'center', key: 'warning_state', minWidth: 100, slot: 'basicTypeSet' },
         {
           title: '派工开始时间', align: 'center', key: 'start_time', minWidth: 200,
           render: (h, params) => h('span', {}, this.func.replaceDate(params.row.start_time * 1, 1))
@@ -103,7 +104,8 @@ export default {
       //详情页返回保留搜索数据
       corssPageData: {},
       warningList: [],
-      userList: []
+      userList: [],
+      url_number_list:[]
     }
   },
   computed: {
@@ -125,6 +127,7 @@ export default {
             { label: '生产完成', value: 2 },
           ]
         },
+         { title: '图号', name: 'Select', serverName: 'url_number', placeholder: '请选择', value: '', optionName: 'label', optionValue: 'value', option: this.url_number_list,filterable:'true' },
         { title: '开始派工时间', name: 'Input', start_server: 'start_time', end_server: 'end_time', start_value: '', end_value: '', isDate: true, serverName: 'id2', start_placeholder: '开始日期', end_placeholder: '结束日期' },
         // {
         //   title: '订单类型', name: 'Select', serverName: 'renovation_type', placeholder: '请选择订单类型', value: '',
@@ -211,7 +214,17 @@ export default {
         if (res.code == 200) {
           this.tableData = res.data.data;
           this.total = res.data.total;
-          this.tableheaders = res.data.tableSet || []
+          this.tableheaders = res.data.tableSet || [];
+          let data = [];
+          res.data.url_number_list.map(v=>{
+            let obj={};
+            obj.label = v;
+            obj.value = v;
+            data.push(obj)
+          })
+          
+          this.url_number_list = data;
+          console.log(this.url_number_list)
         }
       })
     },

+ 20 - 0
src/views/ProductionOrderList/ProductionPlanlist/BST_two.vue

@@ -124,6 +124,7 @@ import { mapState } from "vuex";
 export default {
   data() {
     return {
+      url_number_list:[],
         tableModalColumns: [
         {
           title: "是否展示",
@@ -371,6 +372,8 @@ export default {
           key: "residential_name",
           minWidth: 200,
         },
+         { title: "图号", align: "center", key: "url_number", minWidth: 200,ellipsis:'true',tooltip:'true'
+          },
         { title: "计划单号", align: "center", key: "plan_no", minWidth: 200 },
         // {
         //   title: "订单类型",
@@ -522,6 +525,16 @@ export default {
           placeholder: "请选择项目名称",
           value: "",
         },
+        {
+          title: "图号",
+          name: "Select",
+          serverName: "url_number",
+          placeholder: "请选择",
+          value: "",
+          optionName: "title",
+          optionValue: "title",
+          option: this.url_number_list,
+        },
         // {
         //   title: "订单类型",
         //   name: "Select",
@@ -682,6 +695,13 @@ export default {
           this.tableData = res.data.data;
           this.total = res.data.total;
           // this.tableheaders = res.data.tableSet || []
+          let data =[];
+          res.data.url_number_list.map(v=>{
+           let obj={};
+           obj.title =v;
+           data.push(obj)
+          })
+          this.url_number_list = data
         }
       );
     },

+ 494 - 56
src/views/PurchasingManage/PurchasingOrder/edit.vue

@@ -1,13 +1,13 @@
 <template>
   <div>
-    <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="handleReference(1)"
                 type="primary"
                 v-show="!isCheck"
                 ghost
                 style="margin-right:10px;"
-                :disabled="$route.query.is_refer == 1?true:btn1_disable">参照请购单</Button>
+               >参照采购计划</Button>
         <Button @click="goBack"
                 type="primary"
                 ghost
@@ -22,7 +22,18 @@
     <div class="content_topform">
       <Form :label-width="90"
             :model="searchData">
-        <FormItem label="项目名称:">
+             <FormItem label="订单号:">
+          <Input type="text"
+                 size="small"
+                 v-show="!isCheck"
+                 disabled
+                 v-model="searchData.residential_name"
+                 style="width: 200px;margin-top:6px"
+                 placeholder="自动生成订单号">
+          </Input>
+          <span v-show="isCheck">{{searchData.residential_name}}</span>
+        </FormItem>
+        <!-- <FormItem label="项目名称:">
           <Input type="text"
                  size="small"
                  v-show="!isCheck"
@@ -34,7 +45,7 @@
                 @click="showProjectModal=true">选择</span>
           </Input>
           <span v-show="isCheck">{{searchData.residential_name}}</span>
-        </FormItem>
+        </FormItem> -->
         <FormItem label="供应商名称:">
           <Input type="text"
                  size="small"
@@ -48,7 +59,7 @@
           </Input>
           <span v-show="isCheck">{{searchData.supply_title}}</span>
         </FormItem>
-        <FormItem label="采购类型:">
+        <FormItem label="采购订单类型:">
           <Select v-model="searchData.type_id"
                   size="small"
                   v-show="!isCheck"
@@ -64,7 +75,7 @@
           </Select>
           <span v-show="isCheck">{{searchData.type_title}}</span>
         </FormItem>
-        <FormItem label="单据号:">
+        <!-- <FormItem label="单据号:">
           <Input type="text"
                  size="small"
                  v-show="!isCheck"
@@ -73,9 +84,9 @@
                  style="width: 200px"
                  placeholder="自动生成" />
           <span v-show="isCheck">{{searchData.purchase_order_no}}</span>
-        </FormItem>
-        <FormItem label="制单人:"
-                  v-show="isCheck">
+        </FormItem> -->
+        <!-- <FormItem label="制单人:"
+                  v-show="isCheck"> -->
           <!-- <Select v-model="searchData.nickname"
                   size="small"
                   v-show="!isCheck"
@@ -89,9 +100,9 @@
                     :value="sitem.nickname">
             </Option>
           </Select> -->
-          <span>{{searchData.nickname}}</span>
-        </FormItem>
-        <FormItem label="制单日期:">
+          <!-- <span>{{searchData.nickname}}</span>
+        </FormItem> -->
+        <!-- <FormItem label="制单日期:">
           <DatePicker type="date"
                       v-show="!isCheck"
                       size="small"
@@ -99,8 +110,8 @@
                       placeholder="年/月/日"
                       v-model="searchData.crt_time"></DatePicker>
           <span v-show="isCheck">{{func.replaceDate(searchData.crt_time)}}</span>
-        </FormItem>
-        <FormItem label="预计到货:">
+        </FormItem> -->
+        <FormItem label="预计到货日期:">
           <DatePicker type="date"
                       v-show="!isCheck"
                       size="small"
@@ -123,31 +134,109 @@
     <div class="content_table">
       <div class="content_table_btn">
         <div>
-          <span>购清单</span>
-          <Button @click="showModal=true"
+          <span>购清单</span>
+          <!-- <Button @click="showModal=true"
                   v-show="!isCheck"
                   type="primary"
                   size="small"
                   style="margin-left:10px;"
-                  :disabled="$route.query.is_refer == 0?true:btn_disable">选择物料</Button>
+                  :disabled="$route.query.is_refer == 0?true:btn_disable">选择物料</Button> -->
+          <div><span>参照计划单号:</span><span></span></div>
         </div>
         <div class="content_table_btn_right"
              v-show="!isCheck">
-          <span>税率一键修改: </span>
-          <Input type="text"
-                 size="small"
-                 @on-change="handleModify"
-                 v-model="fax_modify"
-                 style="width: 80px;margin-right:10px"
-                 placeholder="税率">
-          <span slot="append">%</span>
-          </Input>
+           <Dropdown trigger="click" style="margin-left: 20px" @on-click='DropDownSort' >
+        <a href="javascript:void(0)">
+            批量修改
+            <Icon type="ios-arrow-down"></Icon>
+        </a>
+        <DropdownMenu slot="list" >
+            <DropdownItem :name='2'>数量</DropdownItem>
+            <DropdownItem :name='3'>税率</DropdownItem>
+            <DropdownItem :name='1'>项目信息</DropdownItem>
+        </DropdownMenu>
+    </Dropdown>
         </div>
       </div>
       <Table :columns="tableColumns"
              border
-             :data="tableData">
+             :data="tableData"
+             :max-height='500'
+              show-summary 
+              :summary-method="handleSummary"
+              @on-selection-change='selectRow' >
+             <template slot="material_sort" slot-scope="{ row,index }">
+           <span v-if="row.material_title == '选择物料'"></span>
+          <div v-else>
+            <span >{{ tableData[index].material_type }}</span></div>
+        </template>
+         <template slot="material_title" slot-scope="{ row,index }">
+            <span
+              
+              v-show="!isCheck"
+            
+             style="cursor: pointer;color:#2d8cf0"
+             @click="showModal = true"
+
+            >
+            {{tableData[index].material_title}}
+            </span>
+            <span v-show="isCheck">{{ row.material_title }}</span>
+        </template>
+<template slot="project_number" slot-scope="{row}">
+  <span @click="check(row)" style="color: rgb(45, 140, 240);cursor: pointer;">{{row.project_number}}</span>
+</template>
+        <template slot="project_code" slot-scope="{ row,index }">
+          <span v-if="row.material_title == '选择物料'"></span>
+          <div v-else>
+           <Select
+              v-model="tableData[index].project_code"
+              size="small"
+              clearable
+              transfer
+              v-show="!isCheck&&row.project_number!=='查看'"
+              @on-change='selectChange(row,index)'
+              filterable
+              label-in-value
+            >
+              <Option
+                v-for="(sitem,index) in project_number"
+                :key="index"
+                :label="sitem"
+                :value="sitem"
+              >
+              </Option>
+            </Select>
+            <span v-show="isCheck||row.project_number == '查看'" @click="check(row)" style="color: rgb(45, 140, 240);cursor: pointer;">{{row.project_code}}</span>
+            </div>
+        </template>
+        <template slot="project_title" slot-scope="{ row,index }">
+           <span v-if="row.material_title == '选择物料'"></span>
+          <div v-else>
+           <Select
+              v-model="tableData[index].project_title"
+              size="small"
+              clearable
+              transfer
+              @on-change='selectChange(row,index)'
+              v-show="!isCheck&&row.project_number!=='查看'"
+              filterable
+              label-in-value
+            >
+              <Option
+                v-for="(sitem,index) in project_name"
+                :key="index"
+                :label="sitem"
+                :value="sitem"
+              >
+              </Option>
+            </Select>
+            <span v-show="isCheck||row.project_number == '查看'" @click="check(row)" style="color: rgb(45, 140, 240);cursor: pointer;">{{row.project_title}}</span>
+            </div>
+        </template>
        <template slot="numberSet" slot-scope="{row , index }">
+         <span v-if="row.material_title == '选择物料'"></span>
+         <div v-else>
            <Tooltip
             placement="left"
             @on-popper-show="handleToolShow(index, row)"
@@ -169,14 +258,23 @@
             >
             </Input>
             <span v-show="isCheck">{{ tableData[index].num }}</span>
-          </Tooltip>
+            </Tooltip>
+          </div>
         </template>
         <template slot="setSlot"
                   slot-scope="{row,index}">
+          <span v-if="row.material_title == '选择物料'"></span>
+          <div v-else>
+                  <a style="margin:0 5px"
+             v-show="!isCheck"
+             :disabled="row.state==0"
+              @click="handleSet(3,row,index)"
+            >复制</a>
           <a style="margin:0 5px"
              v-show="!isCheck"
              :disabled="row.state==0"
              @click="handleSet(4,row,index)">删除</a>
+           </div>  
         </template>
       </Table>
     </div>
@@ -335,6 +433,51 @@
         </div>
       </div>
     </Modal>
+    <Modal 
+    :width='400'
+    v-model="showTotal"
+    @on-ok='total_sure'
+    :title="total_type==1?'批量修改项目信息':total_type==2?'批量修改数量':'批量修改税率'">
+    <div style="text-align:center">
+      <div v-if="total_type==1">
+        <Form>
+          <FormItem>
+            <span>项目编码 : </span>
+        <Select v-model="total_project_info.code" style="width:200px">
+        <Option v-for="(item,index) in project_number" :value="item" :key="index">{{ item }}</Option>
+    </Select>
+          </FormItem>
+             <FormItem>
+          <span>项目名称 : </span>
+        <Select v-model="total_project_info.name" style="width:200px">
+        <Option v-for="(item,index) in project_name" :value="item" :key="index">{{ item }}</Option>
+    </Select>
+          </FormItem>
+    </Form>
+    </div>
+    <div v-if="total_type==2">
+      <span>数量 : </span><Input v-model="total_num" style="width:50%" type="number"/>
+    </div>
+    <div v-if="total_type == 3">
+      <span>税率一键修改 : </span>
+     <Input v-model="total_fax" style="width:50%" type="number"/>%
+      </div>
+      </div>
+    </Modal>
+    <Modal 
+    :width='800'
+    v-model="showCheck"
+    title="查看">
+      <span>物料名称:{{material_name}}</span>
+      <Table 
+      :columns="CheckTableColumns"
+                   :max-height="520"
+                   border
+          :data='checkData'
+          style='margin-top:10px'
+                   >
+      </Table>
+    </Modal>
   </div>
 </template>
 
@@ -352,8 +495,28 @@ export default {
   data () {
     // 这里存放数据
     return {
+      material_name:'',
+      checkData:[],
+      CheckTableColumns:[
+        { title: '计划单号', key: 'plan_no', align: 'center', minWidth: 150},
+        { title: '采购计划类型', key: 'plan_type_title', align: 'center', minWidth: 100},
+        { title: '项目编码', key: 'project_code', align: 'center', minWidth: 150},
+        { title: '项目名称', key: 'project_name', align: 'center', minWidth: 150},
+         { title: '数量', key: 'purchases_num', align: 'center', minWidth: 100}
+      ],
+      showCheck:false,
+      selectChoose:[],
+      total_fax:0,
+      project_name:[],
+      project_number:[],
+      total_num:'',
+      total_project_info:{
+          code:'',
+          name:""
+      },
+      total_type:'',
+      showTotal:false,
       btn_disable:false,
-      btn1_disable:false,
       fax_modify: '',
       searchData: {
        residential_name: ''
@@ -404,20 +567,25 @@ export default {
         tableData: [{}]
       },
       tableColumns: [
-        { title: '项目名称', key: 'residential_name', align: 'center', minWidth: 140 },
-        { title: '物料分类', key: 'type_title', align: 'center', minWidth: 140 },
-        { title: '物料名称', key: 'title', align: 'center', minWidth: 140 },
+        {key: 'select', align: 'center', minWidth: 80,type:'selection'},
+        { title: '物料分类', key: 'type_title', align: 'center', minWidth: 140,slot:'material_sort'},
+        { title: '物料名称', key: 'material_title', align: 'center', minWidth: 140 ,slot:'material_title'},
         {
           title: '物料规格', key: 'model', align: 'center', minWidth: 140,
           render: (h, params) => {
             const { row } = params
             let text = `${row.long ? row.long : 0}*${row.width ? row.width : 0}*${row.high ? row.high : 0}`
-            return h('span', {}, text)
+            if(row.material_title =='选择物料'){
+              return h('span',{},'')
+            }else{
+               return h('span', {}, text)
+            }
+           
           }
         },
         { title: '计量单位', key: 'unit', align: 'center', minWidth: 100 },
         {
-          title: '采购数量', key: 'num', align: 'center', minWidth: 120,slot:"numberSet"
+          title: '数量', key: 'num', align: 'center', minWidth: 120,slot:"numberSet"
           // render: (h, params) => {
           //   const { row, index } = params
           //   const currentRow = JSON.parse(JSON.stringify(this.tableData[index]))
@@ -443,7 +611,10 @@ export default {
           render: (h, params) => {
             const { row, index } = params
             const currentRow = JSON.parse(JSON.stringify(this.tableData[index]))
-            return this.isCheck ? h('span', {}, currentRow.no_tax_price) : h('Input', {
+            if(row.material_title==='选择物料'){
+              return h('span',{},'')
+            }else{
+              return this.isCheck ? h('span', {}, currentRow.no_tax_price) : h('Input', {
               props: {
                 value: currentRow.no_tax_price,
                 type: 'text'
@@ -461,13 +632,18 @@ export default {
               }
             })
           }
+            }
+            
         },
         {
           title: '税率', key: 'fax', align: 'center', minWidth: 120,
           render: (h, params) => {
             const { row, index } = params
-            const currentRow = JSON.parse(JSON.stringify(this.tableData[index]))
-            return this.isCheck ? h('span', {}, currentRow.fax) : h('Input', {
+            const currentRow = this.tableData[index]
+            if(row.material_title === '选择物料' ){
+              return h('span',{},'')
+            }else{
+                return this.isCheck ? h('span', {}, currentRow.fax) : h('Input', {
               props: {
                 value: currentRow.fax,
                 type: 'text',
@@ -483,12 +659,17 @@ export default {
               }
             }, [h('span', { slot: 'append' }, '%')])
           }
+            }
+          
         },
         {
           title: '含税单价', key: 'price', align: 'center', minWidth: 120,
           render: (h, params) => {
             const { row, index } = params
             const currentRow = JSON.parse(JSON.stringify(this.tableData[index]))
+              if(row.material_title === '选择物料' ){
+              return h('span',{},'')
+            }else{
             return this.isCheck ? h('span', {}, currentRow.price) : h('Input', {
               props: {
                 value: currentRow.price,
@@ -506,12 +687,16 @@ export default {
               }
             })
           }
+          }
         },
         {
           title: '无税金额', key: 'no_tax_amount', align: 'center', minWidth: 120,
           render: (h, params) => {
             const { row, index } = params
             const currentRow = JSON.parse(JSON.stringify(this.tableData[index]))
+              if(row.material_title === '选择物料' ){
+              return h('span',{},'')
+            }else{
             return this.isCheck ? h('span', {}, currentRow.no_tax_amount) : h('Input', {
               props: {
                 value: currentRow.no_tax_amount,
@@ -523,18 +708,22 @@ export default {
                   currentRow.no_tax_price = (1 * currentRow.no_tax_amount / currentRow.num).toFixed(2)
                   currentRow.price = (1 * currentRow.no_tax_price * (1 + 1 * currentRow.fax / 100)).toFixed(2)
                   currentRow.total_price = (1 * currentRow.price * currentRow.num).toFixed(2)
-                  currentRow.tax_amount = (1 * currentRow.total_price - 1 * currentRow.no_tax_price).toFixed(2)
+                  currentRow.tax_amount = (1 * currentRow.total_price - 1 * currentRow.no_tax_amount).toFixed(2)
                   this.tableData.splice(index, 1, currentRow);
                 }
               }
             })
           }
+          }
         },
         {
           title: '税额', key: 'tax_amount', align: 'center', minWidth: 120,
           render: (h, params) => {
             const { row, index } = params
             const currentRow = JSON.parse(JSON.stringify(this.tableData[index]))
+              if(row.material_title === '选择物料' ){
+              return h('span',{},'')
+            }else{
             return this.isCheck ? h('span', {}, currentRow.tax_amount) : h('Input', {
               props: {
                 value: currentRow.tax_amount,
@@ -543,18 +732,24 @@ export default {
               on: {
                 'on-change': (e) => {
                   currentRow.tax_amount = e.target.value
-                  currentRow.fax = (1 * currentRow.tax_amount / currentRow.no_tax_price).toFixed(2)
+                  // currentRow.fax = (1 * currentRow.tax_amount / currentRow.no_tax_price).toFixed(2)
+                 currentRow.no_tax_amount = (1*(currentRow.total_price-currentRow.tax_amount)).toFixed(2)
+                 currentRow.no_tax_price = (1*(currentRow.no_tax_amount/currentRow.num)).toFixed(2)
                   this.tableData.splice(index, 1, currentRow);
                 }
               }
             })
           }
+          }
         },
         {
           title: '价格合计', key: 'total_price', align: 'center', minWidth: 120,
           render: (h, params) => {
             const { row, index } = params
             const currentRow = JSON.parse(JSON.stringify(this.tableData[index]))
+              if(row.material_title === '选择物料' ){
+              return h('span',{},'')
+            }else{
             return this.isCheck ? h('span', {}, currentRow.total_price) : h('Input', {
               props: {
                 value: currentRow.total_price,
@@ -572,10 +767,14 @@ export default {
               }
             })
           }
+          }
         },
-        { title: '操作', key: 'code', align: 'center', minWidth: 100, slot: 'setSlot' },
+         { title: '参照计划单号', key: 'project_number', align: 'center', minWidth: 100,slot:'project_number' },
+          { title: '项目编码', key: 'project_code', align: 'center', minWidth: 100,slot: "project_code" },
+           { title: '项目名称', key: 'project_title', align: 'center', minWidth: 100,slot: "project_title"  },
+        { title: '操作', key: 'code', align: 'center', minWidth: 120, slot: 'setSlot' },
       ],
-      tableData: [],
+      tableData: [{material_title:'选择物料',_disabled:true}],
       showModal: false,
       showProjectModal: false,
       showSupplierModal: false,
@@ -712,6 +911,8 @@ export default {
       usersList: [],
       isCheck: false,
       warningList: [],
+      purchase_data:[],
+      purchase_tableData:[],
     }
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
@@ -727,12 +928,17 @@ export default {
     this.axios({ method: 'get', url: '/api/supply_list', }).then((res) => { this.suppliersList = res.data.data }).catch((err) => { });
     // 获取供应商分类
     this.axios({ method: 'get', url: '/api/basic_supply_list', }).then((res) => { this.modalSupplierData.treeData[0].sub = res.data }).catch((err) => { });
-    // 获取项目列表
-    this.axios({ method: 'get', url: '/api/order_index', }).then((res) => {
-      this.modalProjectData.tableData = res.data.data
-      this.modal_project_total = res.data.total
-      console.log(res);
+     // //获取项目列表
+    this.axios({ method: 'get', url: '/api/purchase_orders_list', }).then((res) => {
+       this.project_name = res.data.project_name;
+       this.project_number = res.data.project_number;
     }).catch((err) => { });
+    // // 获取项目列表
+    // this.axios({ method: 'get', url: '/api/order_index', }).then((res) => {
+    //   this.modalProjectData.tableData = res.data.data
+    //   this.modal_project_total = res.data.total
+    //   console.log(res);
+    // }).catch((err) => { });
     // 获取紧急程度
     this.axios.get('/api/warning_list').then(res => { this.warningList = res.data.data })
     this.initModal()
@@ -746,6 +952,128 @@ export default {
     }
   },
   methods: {
+    check(row){
+      console.log(row);
+      if(row.project_number!=='查看'){
+        return
+      }else{
+      let data=[];
+      this.purchase_data.forEach(v=>{
+        if(row.material_detail_id == v[0].material_detail_id){
+          
+          v.forEach(m=>{
+            let obj ={};
+             obj.plan_no = m.plan_no;
+             obj.plan_type_title=m.plan_type_title;
+             obj.project_code = m.project_code;
+             obj.project_name=m.project_title;
+             obj.purchases_num = m.purchases_num;
+             data.push(obj)
+          })
+         
+        }
+      })
+      this.material_name = row.material_title;
+      this.checkData = data;
+      this.showCheck = true;
+      }
+    },
+   selectRow(e){
+       this.selectChoose = e;
+    },
+    total_sure(){
+     
+      //1项目信息 2数量 3税率
+ switch(this.total_type){
+        case 1:
+          this.tableData.map((v)=>{
+           
+            this.selectChoose.map(m=>{
+              if(m.index == v.index ){
+                     v.project_code =this.total_project_info.code;
+            v.project_title = this.total_project_info.name;
+               v._checked = true;
+               v.ad = true
+              }
+          
+            })
+        
+          })
+          break;
+          case 2:
+             this.tableData.map((v)=>{
+           
+            this.selectChoose.map(m=>{
+              if(m.index == v.index ){
+              
+                     v.num =this.total_num;
+            
+               v._checked = true;
+               v.ad = true
+              }
+          
+            })})
+            break;
+            case 3:
+             this.tableData.map((v)=>{
+       
+            this.selectChoose.map(m=>{
+              if(m.index == v.index ){
+               
+                     v.fax =this.total_fax;
+          
+               v._checked = true;
+               v.ad = true
+              }
+          
+            })})
+            break;
+ }
+    },
+    handleSummary({ columns, data }){
+  const sums = {};
+                columns.forEach((column, index) => {
+                    const key = column.key;
+                    if (index === 1) {
+                        sums[key] = {
+                            key,
+                            value: '合计'
+                        };
+                        return;
+                    }
+                    const values = data.map(item => Number(item[key]));
+                    if (key == 'num'||key=='no_tax_amount'||key=='total_price'||key=='tax_amount') {
+                        let v = values.reduce((prev, curr) => {
+                            const value = Number(curr);
+                            if (!isNaN(value)) {
+                                return prev + curr;
+                            } else {
+                                return prev;
+                            }
+                        }, 0);
+                        //  this.table_total_num = Number(JSON.parse(JSON.stringify(v)));
+                        sums[key] = {
+                            key,
+                            value:v
+                        };
+                    } else {
+                        sums[key] = {
+                            key,
+                            value: ''
+                        };
+                    }
+                });
+
+                return sums;
+            
+    },
+    DropDownSort(val){
+if(this.selectChoose.length == 0){
+        return this.$Message.warning('请先选择物料')
+      }
+      this.showTotal = true;
+      this.total_type = val;
+    },
     changenum(e){
          currentRow.num = e.target.value
                   currentRow.total_price = (1 * currentRow.price * currentRow.num).toFixed(2)
@@ -847,9 +1175,8 @@ export default {
     handleReference (type) {
       this.$reference({
         type,
-        title: '参照请购单',
+        title: '参照采购计划',
         then: (result, data) => {
-          console.log(result)
           result.forEach(element => {
             element.num = 0
             element.no_tax_price = 0
@@ -862,10 +1189,95 @@ export default {
             // element.material_id = element.m_id
             element.supply_id = this.searchData.supply_id
             this.table_state = 1
-            this.btn_disable = true
+          
           });
-          this.tableData = [...this.tableData, ...result]
-          this.searchData.residential_name = result[0].residential_name
+          let obj = {},newArr = [];
+          result.forEach((item,suffix)=>{
+           if(!obj[item.material_detail_id]){
+               let arr =[];
+               arr.push(item);
+               newArr.push(arr);
+               obj[item.material_detail_id]=item;
+           }else{
+             newArr.forEach((v,index)=>{
+                if(v[0].material_detail_id == item.material_detail_id){
+                  v.push(item)
+                }
+             })
+           }
+          })
+       let copy_purchase_data = JSON.parse(JSON.stringify(this.purchase_data));
+        let title = [];
+        copy_purchase_data.forEach(m=>{
+   if(title.indexOf(m[0].material_detail_id)<0){
+                      title.push(m[0].material_detail_id);
+                 }
+        })
+    
+     let content = [];
+         newArr.forEach(v=>{
+           if(copy_purchase_data.length==0){
+            
+             this.purchase_data.push(v)
+           }else{
+               
+               this.purchase_data.forEach((m,index)=>{
+                  let id=[];
+                  let m_content=[];
+                 let val =copy_purchase_data[index];
+                 val.forEach(s=>{
+                     id.push(s.id)
+                 })
+            
+            if(v[0].material_detail_id == m[0].material_detail_id){
+                 m.forEach(mm=>{
+                   v.forEach(vv=>{
+                     if(mm.id == vv.id){
+                       mm.purchases_num = 1*vv.purchases_num+1*mm.purchases_num
+                     }
+                    if(id.indexOf(vv.id)<0){
+                      m_content.push(vv)
+                    }
+                   })
+                  
+                 })
+                m.push(...m_content)
+            }
+            
+           
+         })
+          if(title.indexOf(v[0].material_detail_id)<0){
+            
+              content.push(v)
+             
+            }
+           }
+          
+       })
+       this.purchase_data.push(...content);
+       this.purchase_tableData = [];
+    
+          this.purchase_data.forEach(v=>{
+            let data = {...v[0]};
+             data.num = 0
+            data.no_tax_price = 0
+            data.fax = 0
+            data.price = 0
+            data.no_tax_amount = 0
+            data.tax_amount = 0
+            data.total_price = 0
+            data.project_number = '查看'
+            data.project_code = '查看'
+            data.project_title = '查看'
+            v.forEach(m=>{
+              data.num+=m.purchases_num*1;
+            })
+           this.purchase_tableData.push(data)
+          })
+          console.log(this.purchase_tableData);
+        this.tableData = [{material_title:'选择物料',_disabled:true}];
+          this.tableData.unshift(...this.purchase_tableData,...this.modalData.selectedData)
+          // this.searchData.residential_name = result[0].residential_name
           // console.log(result)
         }
       })
@@ -876,10 +1288,27 @@ export default {
       });
     },
     handleSet (type, row, index) {
-      this.tableData.splice(index, 1)
+      if(type==3){
+        if(row.project_number == '查看'){
+          let obj = JSON.parse(JSON.stringify(row));
+          obj.project_number = '';
+          this.tableData.splice(index+1,0,obj)
+        }else{
+           this.tableData.splice(index+1,0,row);}
+      }else if(type == 4){
+      this.tableData.splice(index, 1);
+      this.purchase_data.forEach((v,idx)=>{
+        if(row.material_detail_id == v[0].material_detail_id){
+              this.purchase_data.splice(idx,1)
+        }
+      })
+      }else{
+        return
+      }
     },
     handleSelect () {
       this.modalData.selectedData.forEach(element => {
+        element.material_title = element.title
         element.num = 0
         element.no_tax_price = 0
         element.fax = 0
@@ -887,16 +1316,22 @@ export default {
         element.no_tax_amount = 0
         element.tax_amount = 0
         element.total_price = 0
-        element.type_title = element.m_title
+        element.material_type = element.m_title
         element.material_id = element.m_id
         element.supply_id = this.searchData.supply_id
+        element.project_code =null;
+        element.project_title=null;
       });
-      this.tableData = [...this.tableData, ...this.modalData.selectedData]
+      // console.log(this.modalData.selectedData);
+     
+      this.tableData.splice(this.tableData.length-1,0,...JSON.parse(JSON.stringify(this.modalData.selectedData))) 
       this.table_state = 0
-      this.btn1_disable = true
       this.tableData.map((item,index)=>{
         item.residential_name = this.currentChoose.residential_name
-        this.tableData.splice(index,1,item) })
+        this.tableData.splice(index,1,item) });
+      this.tableData.map((m,index)=>{
+        m.index = index
+      })
     },
     changeModalSize (e) {
       this.modal_page_size = e;
@@ -1136,4 +1571,7 @@ export default {
 /deep/ .ivu-table-wrapper {
   overflow: visible;
 } //穿透iview
+/deep/ .ivu-checkbox-disabled{
+  display: none!important;
+}
 </style>

+ 83 - 39
src/views/PurchasingManage/PurchasingOrder/list.vue

@@ -1,10 +1,10 @@
 <template>
   <div class="purchase_order">
-    <Toptitle title="采购列表">
+    <Toptitle title="采购订单">
       <slot name="titleButton">
-        <Button type="primary"
+        <!-- <Button type="primary"
                 @click="handleGoPage(1,'')"
-                style="margin-right:10px;">新增</Button>
+                style="margin-right:10px;">新增</Button> -->
         <!-- <Button @click="handleCodeRule"
                 type="primary"
                 ghost
@@ -23,23 +23,7 @@
                  clearable
                  placeholder="订单号" />
         </FormItem>
-        <FormItem label="项目名称:">
-          <Input type="text"
-                 size="small"
-                 clearable
-                 v-model="searchData.project_title"
-                 style="width: 150px"
-                 placeholder="项目名称" />
-        </FormItem>
-        <FormItem label="供应商名称:">
-          <Input type="text"
-                 size="small"
-                 v-model="searchData.supply_title"
-                 style="width: 150px"
-                 clearable
-                 placeholder="供应商名称" />
-        </FormItem>
-        <FormItem label="采购类型:">
+         <FormItem label="采购订单类型:">
           <Select v-model="searchData.type_id"
                   size="small"
                   clearable
@@ -53,17 +37,13 @@
             </Option>
           </Select>
         </FormItem>
-        <FormItem label="提交人:">
-          <Select v-model="searchData.user_id"
-                  size="small"
-                  clearable
-                  style="width: 150px">
-            <Option v-for="(sitem) in userList"
-                    :key="sitem.id"
-                    :label="sitem.nickname"
-                    :value="sitem.id">
-            </Option>
-          </Select>
+        <FormItem label="供应商名称:">
+          <Input type="text"
+                 size="small"
+                 v-model="searchData.supply_title"
+                 style="width: 150px"
+                 clearable
+                 placeholder="供应商名称" />
         </FormItem>
         <FormItem label="订单状态:">
           <Select v-model="searchData.lock"
@@ -76,6 +56,19 @@
                     :value=1 />
           </Select>
         </FormItem>
+        <FormItem label="制单人:">
+          <Select v-model="searchData.user_id"
+                  size="small"
+                  clearable
+                  style="width: 150px">
+            <Option v-for="(sitem) in userList"
+                    :key="sitem.id"
+                    :label="sitem.nickname"
+                    :value="sitem.id">
+            </Option>
+          </Select>
+        </FormItem>
+       
         <FormItem label="审批状态:">
           <Select v-model="searchData.state"
                   size="small"
@@ -91,14 +84,54 @@
                     :value=3 />
           </Select>
         </FormItem>
-        <FormItem label="制单时间:">
+        <FormItem label="审批人:">
+          <Select v-model="searchData.user_id"
+                  size="small"
+                  clearable
+                  style="width: 150px">
+            <Option v-for="(sitem) in userList"
+                    :key="sitem.id"
+                    :label="sitem.nickname"
+                    :value="sitem.id">
+            </Option>
+          </Select>
+        </FormItem>
+        <FormItem label="预计到货日期:">
           <DatePicker type="date"
                       size="small"
                       style="width: 150px"
                       placeholder="年/月/日"
                       v-model="searchData.start_time"></DatePicker>
+       
+       ~
+          <DatePicker type="date"
+                      size="small"
+                      style="width: 150px"
+                      placeholder="年/月/日"
+                      v-model="searchData.end_time"></DatePicker>
         </FormItem>
-        <FormItem label="~">
+         <FormItem label="单据日期:">
+          <DatePicker type="date"
+                      size="small"
+                      style="width: 150px"
+                      placeholder="年/月/日"
+                      v-model="searchData.start_time"></DatePicker>
+       
+       ~
+          <DatePicker type="date"
+                      size="small"
+                      style="width: 150px"
+                      placeholder="年/月/日"
+                      v-model="searchData.end_time"></DatePicker>
+        </FormItem>
+         <FormItem label="订单创建时间:">
+          <DatePicker type="date"
+                      size="small"
+                      style="width: 150px"
+                      placeholder="年/月/日"
+                      v-model="searchData.start_time"></DatePicker>
+       
+       ~
           <DatePicker type="date"
                       size="small"
                       style="width: 150px"
@@ -107,9 +140,12 @@
         </FormItem>
         <FormItem>
           <Button type="primary"
-                  size="small"
+                
                   @click="initData(searchData)"
                   style="margin-right:10px;">搜索</Button>
+                    <Button type="primary"
+                @click="handleGoPage(1,'')"
+                style="margin-right:10px;">新增</Button>
         </FormItem>
       </Form>
     </div>
@@ -121,6 +157,8 @@
                :data="historyTableData">
           <template slot="setSlot"
                     slot-scope="{row,index}">
+                <a style="margin:0 5px"
+               @click="handleSet(6,row,index)">复制</a>
             <a style="margin:0 5px"
                @click="handleSet(2,row,index)">详情</a>
             <a style="margin:0 5px"
@@ -131,7 +169,7 @@
                @click="handleSet(4,row,index)">删除</a>
             <a style="margin:0 5px"
                :disabled="row.state==1||row.state==2"
-               @click="handleSet(5,row,index)">提交</a>
+               @click="handleSet(5,row,index)">审批/弃审</a>
           </template>
         </Table>
       </div>
@@ -178,8 +216,7 @@ export default {
       purchaseTypeList: [],
       tableColumns: [
         { title: '订单号', key: 'purchase_order_no', align: 'center', minWidth: 140 },
-        { title: '项目名称', key: 'residential_name', align: 'center', minWidth: 140 },
-        { title: '采购类型', key: 'type_title', align: 'center', minWidth: 140 },
+        { title: '采购订单类型', key: 'type_title', align: 'center', minWidth: 140 },
         { title: '供应商名称', key: 'supply_title', align: 'center', minWidth: 140 },
         {
           title: '订单状态', key: 'lock', align: 'center', minWidth: 120,
@@ -189,7 +226,7 @@ export default {
             return h('span', {}, text)
           }
         },
-        { title: '提交人', key: 'nickname', align: 'center', minWidth: 100 },
+        { title: '制单人', key: 'nickname', align: 'center', minWidth: 100 },
         {
           title: '审批状态', key: 'state', align: 'center', minWidth: 140,
           render: (h, params) => {
@@ -206,7 +243,14 @@ export default {
           }
         },
         {
-          title: '制单日期', key: 'crt_time', align: 'center', minWidth: 140,
+          title: '单据日期', key: 'crt_time', align: 'center', minWidth: 140,
+          render: (h, params) => {
+            const { row } = params
+            return h('span', {}, this.func.replaceDate(row.crt_time))
+          }
+        },
+         {
+          title: '订单创建时间', key: 'crt_time', align: 'center', minWidth: 140,
           render: (h, params) => {
             const { row } = params
             return h('span', {}, this.func.replaceDate(row.crt_time))

+ 236 - 109
src/views/PurchasingManage/RequisitionOrder/edit.vue

@@ -2,13 +2,13 @@
   <div style="height:93%">
     <Toptitle :title="$route.query.type == 1 ? '新增采购计划' : $route.query.type==2?'采购计划详情':$route.query.type==3?'编辑采购计划':'复制采购计划'">
       <slot name="titleButton">
-        <Button type="primary" ghost style="margin-right: 10px" v-if="$route.query.type==2"
-          >审批/弃审</Button
+        <Button type="primary" ghost style="margin-right: 10px" v-if="$route.query.type==2" @click="examine"
+          >{{searchData.state==0?'审批':'弃审'}}</Button
         >
-         <Button type="primary" ghost style="margin-right: 10px" v-if="$route.query.type==2"
+         <Button type="primary" ghost style="margin-right: 10px" v-if="$route.query.type==2" @click="typeChange(1)"
           >打开</Button
         >
-         <Button type="primary" ghost style="margin-right: 10px" v-if="$route.query.type==2"
+         <Button type="primary" ghost style="margin-right: 10px" v-if="$route.query.type==2" @click="typeChange(0)"
           >关闭</Button
         >
          <Button type="primary" ghost style="margin-right: 10px"
@@ -37,6 +37,7 @@
             size="small"
             v-show="!isCheck"
             disabled
+            v-model="plan_no"
             style="width: 200px; margin-top: 6px"
             placeholder="自动生成计划单号"
           >
@@ -92,6 +93,18 @@
           ></DatePicker>
           <span v-show="isCheck">{{ searchData.order_time?func.replaceDate(searchData.order_time).split(' ')[0]:'' }}</span>
         </FormItem>
+        <FormItem label='制单人:' v-if="$route.query.type==2">
+          <span>{{searchData.user_name}}</span>
+        </FormItem>
+        <FormItem label='审批人:' v-if="$route.query.type==2">
+          <span>{{searchData.check_name?searchData.check_name:''}}</span>
+        </FormItem>
+        <FormItem label='审批状态:' v-if="$route.query.type==2">
+          <span>{{searchData.state==0?'未审批':'已审批'}}</span>
+        </FormItem>
+        <FormItem label='订单创建时间:' v-if="$route.query.type==2">
+          <span>{{searchData.time}}</span>
+        </FormItem>
         <FormItem label="备注:">
           <Input
             type="textarea"
@@ -130,7 +143,7 @@
         </DropdownMenu>
     </Dropdown>
       </div>
-      <Table :columns="tableColumns" border :data="tableData" :max-height='500' show-summary :summary-method="handleSummary">
+      <Table :columns="tableColumns" border :data="tableData" :max-height='500' show-summary :summary-method="handleSummary" @on-selection-change='selectRow'>
         <template slot="materiel_specs" slot-scope="{ row }">
             <span v-if="row.material_title == '选择物料'"></span>
             <div v-else>
@@ -153,7 +166,7 @@
             </Input> -->
             <span >{{ tableData[index].material_type }}</span></div>
         </template>
-        <template slot="material_title" slot-scope="{ index }">
+        <template slot="material_title" slot-scope="{ row,index }">
             <span
               
               v-show="!isCheck"
@@ -164,7 +177,7 @@
             >
             {{tableData[index].material_title}}
             </span>
-            <span v-show="isCheck">{{ tableData[index].title }}</span>
+            <span v-show="isCheck">{{ row.material_title }}</span>
         </template>
         <template slot="project_code" slot-scope="{ row,index }">
           <span v-if="row.material_title == '选择物料'"></span>
@@ -175,17 +188,20 @@
               clearable
               transfer
               v-show="!isCheck"
+              @on-change='selectChange(row,index)'
               filterable
               label-in-value
             >
               <Option
-                v-for="sitem in demo"
-                :key="sitem.id"
-                :label="sitem.label"
-                :value="sitem.value"
+                v-for="(sitem,index) in project_number"
+                :key="index"
+                :label="sitem"
+                :value="sitem"
               >
               </Option>
-            </Select></div>
+            </Select>
+            <span v-show="isCheck">{{row.project_code}}</span>
+            </div>
         </template>
         <template slot="project_title" slot-scope="{ row,index }">
            <span v-if="row.material_title == '选择物料'"></span>
@@ -195,18 +211,21 @@
               size="small"
               clearable
               transfer
+              @on-change='selectChange(row,index)'
               v-show="!isCheck"
               filterable
               label-in-value
             >
               <Option
-                v-for="sitem in demo"
-                :key="sitem.id"
-                :label="sitem.label"
-                :value="sitem.value"
+                v-for="(sitem,index) in project_name"
+                :key="index"
+                :label="sitem"
+                :value="sitem"
               >
               </Option>
-            </Select></div>
+            </Select>
+            <span v-show="isCheck">{{row.project_title}}</span>
+            </div>
         </template>
         <template slot="numberSet" slot-scope="{row , index }">
            <span v-if="row.material_title == '选择物料'"></span>
@@ -224,7 +243,7 @@
             </div>
             <Input
               v-show="!isCheck"
-             
+             @on-change='selectChange(row,index)'
               size="small"
               v-model="tableData[index].num"
               placeholder="数量"
@@ -241,6 +260,7 @@
               type="date"
               size="small"
               transfer
+              @on-change='selectChange(row,index)'
               v-show="!isCheck"
               placeholder="年/月/日"
               v-model="tableData[index].time"
@@ -257,6 +277,7 @@
               size="small"
               clearable
               transfer
+              @on-change='selectChange(row,index)'
               v-show="!isCheck"
               filterable
               label-in-value
@@ -372,7 +393,7 @@
         </div>
       </div>
     </Modal>
-    <Modal
+    <!-- <Modal
       v-model="showProjectModal"
       title="选择项目"
       width="80"
@@ -431,7 +452,7 @@
           </div>
         </div>
       </div>
-    </Modal>
+    </Modal> -->
     <Modal 
     :width='400'
     v-model="showTotal"
@@ -443,13 +464,13 @@
           <FormItem>
             <span>项目编码 : </span>
         <Select v-model="total_project_info.code" style="width:200px">
-        <Option v-for="item in demo" :value="item.value" :key="item.value">{{ item.label }}</Option>
+        <Option v-for="(item,index) in project_number" :value="item" :key="index">{{ item }}</Option>
     </Select>
           </FormItem>
              <FormItem>
           <span>项目名称 : </span>
         <Select v-model="total_project_info.name" style="width:200px">
-        <Option v-for="item in demo" :value="item.value" :key="item.value">{{ item.label }}</Option>
+        <Option v-for="(item,index) in project_name" :value="item" :key="index">{{ item }}</Option>
     </Select>
           </FormItem>
     </Form>
@@ -490,12 +511,17 @@ export default {
   // import引入的组件需要注入到对象中才能使用
   data() {
     // 这里存放数据
-    let vm = this
     return {
+      m_id:'',
+      selectChoose:[],
+      project_name:[],
+      project_number:[],
+      delData:[],
+      plan_no:'',
       selectAll:false,
         ruleValidate: {
                     time: [
-                        { required: true,type: 'all', message: '单据日期不能为空',trigger: 'change'}
+                        { required: true, message: '单据日期不能为空',trigger: 'change'}
                     ],},
       table_total_num:0,
       tableDataAlways:{material_title:'选择物料',_disabled:true},
@@ -627,10 +653,10 @@ export default {
           },
         ],
       },
-      modalProjectData: {
-        title: "",
-        tableData: [{}],
-      },
+      // modalProjectData: {
+      //   title: "",
+      //   tableData: [{}],
+      // },
       suppliersList: [],
       selectedColumns: [
         { title: "物料名称", key: "title", align: "center", minWidth: 110 },
@@ -726,13 +752,24 @@ export default {
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
   created() {
+    if(this.$route.query.type == 6){
+      this.plan_no = '';
+    }else{
+      this.plan_no = this.$route.query.plan_no;
+    }
     this.$route.query.type == 2
       ? (this.isCheck = true)
       : (this.isCheck = false);
     // 获取采购类型
     this.axios({ method: "get", url: "/api/basic_purchase_list" })
       .then((res) => {
-        this.purchaseTypeList = res.data.data;
+        if(res.code == 200){
+          res.data.data.forEach(v=>{
+            if(v.type_id==1){
+              this.purchaseTypeList.push(v)
+            }
+          })
+        }
       })
       .catch((err) => {});
     // 获取操作员
@@ -750,16 +787,16 @@ export default {
       })
       .catch((err) => {});
     // //获取项目列表
-    // this.axios({ method: 'get', url: '/api/order_index', }).then((res) => {
-    //   this.modalProjectData.tableData = res.data.data
-    //   this.modal_project_total = res.data.total
-    // }).catch((err) => { });
+    this.axios({ method: 'get', url: '/api/purchase_orders_list', }).then((res) => {
+       this.project_name = res.data.project_name;
+       this.project_number = res.data.project_number;
+    }).catch((err) => { });
     // 获取紧急程度
     this.axios.get("/api/warning_list").then((res) => {
       this.warningList = res.data.data;
     });
     this.initModal();
-    this.initProjectModal();
+    // this.initProjectModal();
     
   },
   // 生命周期 - 挂载完成(可以访问DOM元素)
@@ -774,12 +811,12 @@ export default {
       this.tableColumns.pop();
       this.tableColumns.push({
           title: "状态",
-          key: "model",
+          key: "lock",
           align: "center",
           minWidth: 100,
           render: (h, params) => {
             const { row } = params
-            let text = `${row.long ? row.long : 0}*${row.width ? row.width : 0}*${row.high ? row.high : 0}`
+            let text = row.lock==1?'打开':'关闭'
             return h('span', {
             }, text)
           },
@@ -787,50 +824,75 @@ export default {
     }
   },
   methods: {
-    renderChecked(h,{column,index}){
-   
-           return h("span",
-             [    h("Checkbox", {
-                      on:{
-                         'on-change':(val)=>{
-                           if(val){
-                             
-                              this.tableData.map(v=>{
-                             v.isSelect = true;
-                           })
-                           this.modalData.selectedData.forEach(m=>{
-                             m.isSelect = true;
-                           })
-                           this.$forceUpdate();
-                           console.log(this.tableData);
-                           }else{
-                               this.tableData.map(v=>{
-                             v.isSelect = false;
-                           })
-                           }
-                         },
-                      props:{
-                        value:this.selectAll
-                      }
-                      }
-                    }),
-                    h("span",'全选'),
-                  ]
-                  
-                  )
-        
+    examine(){
+      
+      let state='';
+     
+       if(this.searchData.state == 0){
+            state = 1;
+       }else{
+         state = 0;
+       }
+       this.axios.get('/api/purchase_apply_check',{params:{state,plan_no:this.$route.query.plan_no}}).then((res)=>{
+          if(res.code==200){
+             this.$Message.success(res.msg);
+             this.initData()
+           }
+       })
     },
+    typeChange(val){ 
+      if(this.selectChoose.length==0){
+        return this.$Message.warning("请先选择物料")
+      }
+      let id=[];
+      this.selectChoose.forEach(v=>{
+        id.push(v.id);
+      })
+      let state = val;
+     this.axios.post('/api/purchase_apply_switch',{id,state}).then((res)=>{
+           if(res.code==200){
+             this.$Message.success(res.msg);
+             this.initData();
+           }
+     })
+    },
+    selectRow(e){
+       this.selectChoose = e;
+    },
+   selectChange(row,index){
+      if(!row.copy&&!row.edit){
+        this.tableData[index].change = true;
+        console.log(this.tableData)
+      }
+   },
     total_sure(){
       //1项目信息;2数量;3预计到货时间;4建议供应商
       switch(this.total_type){
         case 1:
+          this.tableData.map((v)=>{
+            this.selectChoose.map(m=>{
+              if(m.index == v.index ){
+                     v.project_code =this.total_project_info.code;
+            v.project_title = this.total_project_info.name;
+               v._checked = true;
+               v.ad = true
+              }
+          
+            })
+            // if(index==(this.tableData.length-1)){
+            //   v.project_title = null;
+            //   v.project_code = null;
+            // }
+          })
           break;
         case 2:
-          this.tableData.map((v,index)=>{
+          this.tableData.map((v)=>{
+this.selectChoose.map(m=>{
+              if(m.index == v.index ){
             v.num = JSON.parse(JSON.stringify(this.total_num));
-            if(index==(this.tableData.length-1)){
-              v.num = 0;
-            }
+             v._checked = true;
+             v.ad = true
+              }})
             // this.$set(this.tableData.num,index,this.total_num)
           })
 
@@ -838,9 +900,13 @@ export default {
           this.$forceUpdate();
           break;
         case 3:
-           this.tableData.map((v,index)=>{
+           this.tableData.map((v)=>{
+             this.selectChoose.map(m=>{
+              if(m.index == v.index ){
              v.time = this.func.replaceDate(parseInt(new Date(this.total_time).getTime() / 1000)) || "";
              v.arrive_time = v.time;
+              v._checked = true;
+              v.ad = true}})
             //  this.tableData[index].time = this.total_time;
            })
            console.log(this.tableData);
@@ -848,7 +914,11 @@ export default {
           break;
         case 4:
           this.tableData.map(v=>{
+            this.selectChoose.map(m=>{
+              if(m.index == v.index ){
             v.supply_id = this.total_supplier;
+             v._checked = true;
+             v.ad = true}})
           })
           break
       }
@@ -900,6 +970,9 @@ export default {
                 return sums;
             },
     DropDownSort(val){
+      if(this.selectChoose.length == 0){
+        return this.$Message.warning('请先选择物料')
+      }
       this.showTotal = true;
       this.total_type = val;
          console.log(val)
@@ -924,17 +997,23 @@ export default {
     },
     initData() {
       this.axios({
-        method: "get",
+        method: "post",
         url: "/api/purchase_apply_detail",
-        params: {
-          plan_no: this.$route.query.plan_no,
+        data: {
+          plan_no: [this.$route.query.plan_no],
         },
       })
         .then((res) => {
-          // this.tableData = [{material_title:'选择物料'}] 
+          if(this.$route.query.type==2){
+              this.tableData = []
+          }else{
+            this.tableData = [{material_title:'选择物料',_disabled:true}] 
+          }
+          
           this.tableData.unshift(...res.data.children);
           this.searchData = res.data;
           this.searchData.time = this.func.replaceDate(res.data.crt_time);
+          this.searchData.order_time = this.func.replaceDate(res.data.order_time);
           this.tableData.forEach((element) => {
             element.time = this.func.replaceDate(element.arrive_time);
             element.warehouse_list = []
@@ -972,13 +1051,19 @@ export default {
           .then((res) => {
             this.modal_total = res.data.total;
             this.modalData.tableData = res.data.data;
+            this.m_id = row.id
           })
           .catch((err) => {});
     },
     handleSet(type, row, index) {
       if(type == 1){
+        if(!row.copy&&!row.edit){
+          this.delData.push(row.id)
+        }
          this.tableData.splice(index, 1);
+         console.log(this.delData)
       }else{
+        row.copy=true;
         this.tableData.splice(index,0,row)
       }
      
@@ -1027,14 +1112,14 @@ export default {
       this.modal_page_index = e;
       this.initModal();
     },
-    changeProjectModalSize(e) {
-      this.modal_project_page_size = e;
-      this.initProjectModal();
-    },
-    changeProjectModalPage(e) {
-      this.modal_project_page_index = e;
-      this.initProjectModal();
-    },
+    // changeProjectModalSize(e) {
+    //   this.modal_project_page_size = e;
+    //   this.initProjectModal();
+    // },
+    // changeProjectModalPage(e) {
+    //   this.modal_project_page_index = e;
+    //   this.initProjectModal();
+    // },
     handleSelectedDele(row, index) {
       this.modalData.selectedData.splice(index, 1);
     },
@@ -1046,6 +1131,7 @@ export default {
           page_index: this.modal_page_index,
           page_size: this.modal_page_size,
           title: this.modalData.title,
+          m_id:this.m_id
         },
       })
         .then((res) => {
@@ -1055,28 +1141,28 @@ export default {
         })
         .catch((err) => {});
     },
-    initProjectModal() {
-      this.axios({
-        method: "get",
-        url: "/api/order_index",
-        params: {
-          page_index: this.modal_project_page_index,
-          page_size: this.modal_project_page_size,
-          title: this.modalProjectData.title,
-        },
-      })
-        .then((res) => {
-          this.modal_project_total = res.data.total;
-          this.modalProjectData.tableData = res.data.data;
-        })
-        .catch((err) => {});
-    },
+    // initProjectModal() {
+    //   this.axios({
+    //     method: "get",
+    //     url: "/api/order_index",
+    //     params: {
+    //       page_index: this.modal_project_page_index,
+    //       page_size: this.modal_project_page_size,
+    //       title: this.modalProjectData.title,
+    //     },
+    //   })
+    //     .then((res) => {
+    //       this.modal_project_total = res.data.total;
+    //       this.modalProjectData.tableData = res.data.data;
+    //     })
+    //     .catch((err) => {});
+    // },
     handleSelect() {
       this.modalData.selectedData.forEach((element) => {
         element.material_id = element.m_id;
         element.material_type = element.m_title;
         element.material_title = element.title;
-        element.isSelect = false;
+        element.edit = true;
         element.project_code =null;
         element.project_title=null;
         element.arrive_time = this.func.replaceDate(element.arrive_time)
@@ -1088,9 +1174,11 @@ export default {
       this.tableData.splice(
         this.tableData.length - 1,
         0,
-        ...this.modalData.selectedData
+        ...JSON.parse(JSON.stringify(this.modalData.selectedData))
       );
-      console.log(this.tableData)
+      this.tableData.map((m,index)=>{
+        m.index = index
+      })
       // console.log('this.modalData.selectedData :>> ', this.modalData.selectedData);
     },
     handleProjectSelect() {
@@ -1101,6 +1189,9 @@ export default {
       this.$router.go(-1);
     },
     postData() {
+      if(!this.searchData.order_time){
+       return this.$Message.warning('请选择单据日期')
+      };
        let objData = [];
         objData =JSON.parse(JSON.stringify(this.tableData)); 
         objData.pop();
@@ -1114,12 +1205,9 @@ export default {
           parseInt(new Date(element.time).getTime() / 1000) || "";
       });
       let url;
-      if (this.$route.query.type == 1) {
+      if (this.$route.query.type == 1||this.$route.query.type == 6) {
         url = "/api/purchase_apply_add";
-      } else {
-        url = "/api/purchase_apply_edit";
-      }
-      this.axios({
+         this.axios({
         method: "post",
         url,
         data: {
@@ -1135,6 +1223,45 @@ export default {
         
         })
         .catch((err) => {});
+      } else {
+        url = "/api/purchase_apply_edit";
+         let upd_list = [];
+         let add_list = [];
+         let del_list = this.delData;
+         objData.forEach(v=>{
+           if(v.edit||v.copy){
+              add_list.push(v)
+           }
+            if(v.change||v.ad){
+              if(!v.edit||!v.copy){
+                 upd_list.push(v)
+              }
+            
+           }
+         })
+         this.axios({
+        method: "post",
+        url,
+        data: {
+          plan_no:this.$route.query.plan_no,
+          plan_type:this.searchData.plan_type,
+          remark:this.searchData.remark,
+          order_time:this.searchData.order_time,
+          upd_list,
+          add_list,
+          del_list
+        },
+      })
+        .then((res) => {
+          if(res.code == 200){
+              this.$Message.success(res.msg);
+          this.goBack();
+          }
+        
+        })
+        .catch((err) => {});
+      }
+     
     },
   },
   // 监听属性 类似于data概念

+ 42 - 64
src/views/PurchasingManage/RequisitionOrder/list.vue

@@ -19,40 +19,12 @@
           <Input type="text"
                  size="small"
                  clearable
-                 v-model="searchData.order_no"
+                 v-model="searchData.plan_no"
                  style="width: 150px"
                  placeholder="订单号" />
         </FormItem>
-        <FormItem label="项目编码:">
-           <Select v-model="searchData.project_title"
-                  size="small"
-                  clearable
-                  filterable
-                  label-in-value
-                  style="width: 150px">
-            <Option v-for="(sitem) in project_code"
-                    :key="sitem.id"
-                    :label="sitem.title"
-                    :value="sitem.id">
-            </Option>
-          </Select>
-        </FormItem>
-        <FormItem label="项目名称:">
-          <Select v-model="searchData.type_id"
-                  size="small"
-                  clearable
-                  filterable
-                  label-in-value
-                  style="width: 150px">
-            <Option v-for="(sitem) in purchaseTypeList"
-                    :key="sitem.id"
-                    :label="sitem.title"
-                    :value="sitem.id">
-            </Option>
-          </Select>
-        </FormItem>
         <FormItem label="采购计划类型:" :label-width='110'>
-          <Select v-model="searchData.requisition_type"
+          <Select v-model="searchData.plan_type"
                   size="small"
                   clearable
                   filterable
@@ -70,14 +42,16 @@
                   size="small"
                   clearable
                   style="width: 150px">
-            <Option label='正常'
-                    :value=0 />
             <Option label='已关闭'
-                    :value=1 />
+                    :value='0' />
+            <Option label='部分关闭'
+                    :value='1' />
+              <Option label='正常'
+                    :value='2' />
           </Select>
         </FormItem>
         <FormItem label="制单人:">
-          <Select v-model="searchData.user_id"
+          <Select v-model="searchData.crt_id"
                   size="small"
                   clearable
                   style="width: 150px">
@@ -93,18 +67,14 @@
                   size="small"
                   clearable
                   style="width: 150px">
-            <Option label='未提交'
-                    :value=0 />
-            <Option label='审核中'
-                    :value=1 />
-            <Option label='通过'
-                    :value=2 />
-            <Option label='驳回'
-                    :value=3 />
+            <Option label='未审核'
+                    :value='0' />
+            <Option label='已审核'
+                    :value='1' />
           </Select>
         </FormItem>
       <FormItem label="审批人:">
-          <Select v-model="searchData.user_id"
+          <Select v-model="searchData.check_id"
                   size="small"
                   clearable
                   style="width: 150px">
@@ -134,13 +104,13 @@
                       size="small"
                       style="width: 150px"
                       placeholder="年/月/日"
-                      v-model="searchData.time[0]"></DatePicker>
+                      v-model="searchData.time[2]"></DatePicker>
         ~
           <DatePicker type="date"
                       size="small"
                       style="width: 150px"
                       placeholder="年/月/日"
-                      v-model="searchData.time[1]"></DatePicker>
+                      v-model="searchData.time[3]"></DatePicker>
         </FormItem>
        
       </Form>
@@ -168,13 +138,12 @@
             <a style="margin:0 5px"
                @click="handleSet(2,row,index)">详情</a>
             <a style="margin:0 5px"
-               :disabled="row.state==1||row.state==2"
+               v-if="!row.state==1||!row.state==2"
                @click="handleSet(3,row,index)">编辑</a>
             <a style="margin:0 5px"
-               :disabled="row.state==1||row.state==2"
+               v-if="!row.state==1||!row.state==2"
                @click="handleSet(4,row,index)">删除</a>
             <a style="margin:0 5px"
-               :disabled="row.state==1||row.state==2"
                @click="handleSet(5,row,index)">{{row.state==0?'审批':'弃审'}}</a>
           </template>
         </Table>
@@ -213,27 +182,25 @@ export default {
       requisition_type_List:[],
       project_code:[],
       searchData: {
-        requisition_type:'',
-        order_no: '',
-        project_title: '',
-        type_id: '',
+      lock:'',
+       crt_id: '',
+        check_id: '',
         state: '',
-        user_id: '',
-        time: [],
         start_time: '',
         end_time: '',
+        order_start_time:'',
+        order_end_time:'',
+        time:[],
       },
       purchaseTypeList: [],
       tableColumns: [
         { title: '计划单号', key: 'plan_no', align: 'center', minWidth: 140 },
-        { title: '项目编码', key: 'residential_name', align: 'center', minWidth: 140 },
-        { title: '项目名称', key: 'residential_name', align: 'center', minWidth: 140 },
-        { title: '采购计划类型', key: 'type_title', align: 'center', minWidth: 140 },
+        { title: '采购计划类型', key: 'plan_type_title', align: 'center', minWidth: 140 },
         {
           title: '订单状态', key: 'lock', align: 'center', minWidth: 140,
           render: (h, params) => {
             const { row } = params
-            const text = row.lock == 0 ? '正常' : '已关闭'
+            const text = row.lock == 0 ? '已关闭' :row.lock == 1?'部分关闭':'正常'
             return h('span', {}, text)
           }
         },
@@ -246,6 +213,7 @@ export default {
             return h('span', {}, text)
           }
         },
+         { title: '审批人', key: 'check_name', align: 'center', minWidth: 140 },
         {
           title: '单据日期', key: 'crt_time', align: 'center', minWidth: 180,
           render: (h, params) => {
@@ -260,19 +228,27 @@ export default {
             return h('span', {}, this.func.replaceDate(row.crt_time))
           }
         },
-        { title: '操作', key: 'code', align: 'center', minWidth: 200, slot: 'setSlot' },
+        { title: '操作', key: 'code', align: 'center', minWidth: 210, slot: 'setSlot' },
       ],
       tableData: [{}],
       pageIndex: 1,
       pageSize: 10,
       total: 0,
-      userList: []
+      userList: [],
     }
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
   created () {
     // 获取采购类型
-    this.axios({ method: 'get', url: '/api/basic_purchase_list', }).then((res) => { this.purchaseTypeList = res.data.data }).catch((err) => { });
+    this.axios({ method: 'get', url: '/api/basic_purchase_list', }).then((res) => { 
+      if(res.code == 200){
+          res.data.data.forEach(v=>{
+            if(v.type_id==1){
+              this.requisition_type_List.push(v)
+            }
+          })
+        }
+      }).catch((err) => { });
     // 获取操作员
     this.axios('/api/user').then(res => this.userList = res.data.data)
   },
@@ -289,8 +265,10 @@ export default {
   },
   methods: {
     initData () {
-      this.searchData.start_time = parseInt(new Date(this.searchData.time[0]).getTime() / 1000) || ''
-      this.searchData.end_time = parseInt(new Date(this.searchData.time[1]).getTime() / 1000) || ''
+      this.searchData.start_time = parseInt(new Date(this.searchData.time[2]).getTime() / 1000) || ''
+      this.searchData.end_time = parseInt(new Date(this.searchData.time[3]).getTime() / 1000) || ''
+      this.searchData.order_start_time = parseInt(new Date(this.searchData.time[0]).getTime() / 1000) || ''
+      this.searchData.order_end_time = parseInt(new Date(this.searchData.time[1]).getTime() / 1000) || ''
       this.axios({
         method: 'get',
         url: '/api/purchase_apply_list',
@@ -343,7 +321,7 @@ export default {
                 params: {
                   plan_no: row.plan_no,
                   // lock: row.lock,
-                  state: row.state,
+                  state: row.state==0?1:0,
                 }
               }).then((res) => {
                 this.$Message.success(res.msg)