list.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <template>
  2. <div>
  3. <Toptitle title="合同列表">
  4. </Toptitle>
  5. <div style="height:85%;overflow:auto">
  6. <Form :label-width='100' class="search_form">
  7. <FormItem label='项目编码:'>
  8. <Input v-model="searchData.order_no" clearable placeholder="请搜索" class="form_item"/>
  9. </FormItem>
  10. <FormItem label='项目名称:'>
  11. <Input v-model="searchData.project_title" clearable placeholder="请搜索" class="form_item"/>
  12. </FormItem>
  13. <FormItem label='项目阶段:'>
  14. <Select filterable clearable v-model="searchData.phase" placeholder="请选择" class="form_item">
  15. <Option v-for="(item,index) in agreementList" :key="index" :value="item.id" :label="item.title"></Option>
  16. </Select>
  17. </FormItem>
  18. <FormItem label='客户名称:'>
  19. <Input v-model="searchData.customer" clearable placeholder="请搜索" class="form_item"/>
  20. </FormItem>
  21. <FormItem label='金螳螂ID:'>
  22. <Input v-model="searchData.customer_id" clearable placeholder="请搜索" class="form_item"/>
  23. </FormItem>
  24. <FormItem label='项目日期:'>
  25. <DatePicker type="date" placeholder="年/月/日" style="width: 200px" v-model="searchData.start_time" class="form_item"></DatePicker>~
  26. <DatePicker type="date" placeholder="年/月/日" style="width: 200px" v-model="searchData.end_time" class="form_item"></DatePicker>
  27. </FormItem>
  28. <FormItem>
  29. <Button type="primary" @click="search(searchData)">搜索</Button>
  30. </FormItem>
  31. </Form>
  32. <div class="table_top">
  33. <Button type="primary" @click="goAdd(1,null)">新增</Button>
  34. </div>
  35. <Table :data='tableData' :columns='tableColumns' max-height='550' border>
  36. <template slot="set" slot-scope="{row}">
  37. <a @click="goAdd(2,row)">编辑</a>
  38. <a style="margin-left:10px" @click="goAdd(3,row)">变更</a>
  39. <a style="margin-left:10px" @click="goAdd(4,row)">详情</a>
  40. <a style="margin-left:10px" @click="goPlan(row)">下计划</a>
  41. <a style="margin-left:10px" @click='goAdd(5,row)'>删除</a>
  42. </template>
  43. </Table>
  44. </div>
  45. <div class="content_body_page">
  46. <Page
  47. :page-size-opts="[10, 20, 30, 40, 100]"
  48. @on-page-size-change="changeSize"
  49. @on-change="changePage"
  50. :current="pageIndex"
  51. show-total
  52. show-elevator
  53. :total="total"
  54. show-sizer
  55. :page-size="pageSize"
  56. />
  57. </div>
  58. <Modal title="下计划" v-model="showPlan" width='30' @on-ok='postPlanData'>
  59. <Form style="margin-top:20px">
  60. <FormItem label='码单时间:' style="width:100%;">
  61. <DatePicker type='date' v-model="plan_weight_data.start_time" placeholder='年/月/日' style="width:30%"/>
  62. ~
  63. <DatePicker type="date" v-model="plan_weight_data.end_time" placeholder='年/月/日' style="width:30%" />
  64. </FormItem>
  65. <FormItem :label='`${item.title}时间:`' style="width:100%;" v-for="item in planData" :key="item.id"><DatePicker type="date" placeholder='年/月/日' v-model="item.start_time" style="width:30%"/>
  66. ~
  67. <DatePicker type="date" v-model="item.end_time" placeholder='年/月/日' style="width:30%"/></FormItem>
  68. </Form>
  69. </Modal>
  70. </div>
  71. </template>
  72. <script>
  73. export default {
  74. data(){
  75. return{
  76. planData:[],
  77. showPlan:false,
  78. order_no:'',
  79. plan_weight_data:{},
  80. proxyData:{},
  81. pageSize:10,
  82. pageIndex:1,
  83. total:0,
  84. agreementList:[{title:'立项',id:1},{title:'评审',id:2},{title:'报价',id:3},{title:'投标',id:4},{title:'中标',id:5},{title:'废标',id:6}],
  85. searchData:{
  86. phase:'',//项目阶段
  87. order_no:'',//项目编码
  88. project_title:'',//项目名称
  89. customer:'',//客户名称
  90. start_time:'',//
  91. customer_id:'',//金螳螂id
  92. end_time:''//
  93. },
  94. tableData:[],
  95. tableColumns:[
  96. {title:'序号',type:'index',align:'center',minWidth:80},
  97. {title:'项目编码',align:'center',minWidth:120,key:'order_no'},
  98. {title:'项目名称',align:'center',minWidth:120,key:'project_title'},
  99. {title:'项目地址',align:'center',minWidth:150,key:'project_address'},
  100. {title:'联系人',align:'center',minWidth:100,key:'connect_person'},
  101. {title:'联系电话',align:'center',minWidth:130,key:'connect_phone'},
  102. {title:'项目阶段',align:'center',minWidth:100,key:'phase',render:(h,params)=>{
  103. const {row} = params;
  104. const text = this.agreementList.filter(v=>{
  105. return row.phase.split(',').indexOf(v.id.toString())>=0
  106. })
  107. let val = []
  108. text.forEach(element => {
  109. val.push(element.title)
  110. });
  111. return h('span',{},val.toString());
  112. }},
  113. {title:'项目日期',align:'center',minWidth:120,key:'project_date',render:(h,params)=>{
  114. const {row} = params;
  115. return h('span',{},this.func.replaceDateNoHMS(row.project_date))
  116. }},
  117. {title:'客户名称',align:'center',minWidth:100,key:'customer'},
  118. {title:'紧急程度',align:'center',minWidth:100,key:'warning_state',render:(h,params)=>{
  119. const {row} = params;
  120. const text = row.warning_state==1?'普通':row.warning_state==2?'紧急':'非常紧急';
  121. return h('span',{},text);
  122. }},
  123. {title:'金螳螂ID',align:'center',minWidth:120,key:'customer_id'},
  124. {title:'合同金额',align:'center',minWidth:120,key:'agreement_price'},
  125. {title:'核量金额',align:'center',minWidth:120,key:'quantity_price'},
  126. {title:'备注',align:'center',minWidth:150,key:'remark'},
  127. {title:'操作',align:'center',minWidth:250,key:'set',slot:"set", fixed: 'right'},
  128. ]
  129. }
  130. },
  131. mounted(){
  132. this.initData();
  133. },
  134. methods:{
  135. goPlan(row){
  136. // if(this.selectData.length==0){
  137. // return this.$Message.warning('请先选择图号!')
  138. // }
  139. return alert('暂未开发!')
  140. this.order_no = row.order_no;
  141. this.axios.get('/api/basics_procedure_index').then(res=>{
  142. this.planData = res.data.data;
  143. this.planData.forEach(v=>{
  144. v.basic_procedure_id = v.id
  145. v.start_time='';
  146. v.end_time='';
  147. })
  148. this.axios.get('/api/bst_order_pic_number_list',{params:{order_no:row.order_no,page_size:1,page_index:1}}).then(resp=>{
  149. this.planData.forEach(v=>{
  150. resp.data.plan.forEach(m=>{
  151. if(v.basic_procedure_id==m.basic_procedure_id){
  152. v.start_time = m.start_time==0?'':new Date(m.start_time*1000);
  153. v.end_time = m.end_time==0?'':new Date(m.end_time*1000);
  154. }
  155. })
  156. })
  157. let arr;
  158. resp.data.plan.forEach(v=>{
  159. if(v.basic_procedure_id==-1){
  160. arr =v;
  161. }
  162. })
  163. if(arr){
  164. arr.start_time = arr.start_time==0?'':new Date(arr.start_time*1000);
  165. arr.end_time = arr.end_time==0?'':new Date(arr.end_time*1000);
  166. this.plan_weight_data = arr
  167. }
  168. this.showPlan=true
  169. })
  170. })
  171. },
  172. postPlanData(){
  173. let time = JSON.parse(JSON.stringify(this.planData));
  174. let weight_time = JSON.parse(JSON.stringify(this.plan_weight_data));
  175. time.forEach(v=>{
  176. v.start_time = v.start_time?Date.parse(v.start_time).toString().slice(0,10):'';
  177. v.end_time = v.end_time?Date.parse(v.end_time).toString().slice(0,10):'';
  178. })
  179. weight_time.start_time = weight_time.start_time?Date.parse(weight_time.start_time).toString().slice(0,10):'';
  180. weight_time.end_time = weight_time.end_time?Date.parse(weight_time.end_time).toString().slice(0,10):'';
  181. weight_time.basic_procedure_id = -1;
  182. weight_time.type=-1;
  183. time.push(weight_time);
  184. let obj = {};
  185. obj.order_no =this.order_no;
  186. obj.procedure_list = time;
  187. // obj.pic_number = [];
  188. // this.selectData.forEach(v=>{
  189. // obj.pic_number.push(v.id)
  190. // })
  191. this.axios.post('/api/bst_order_pic_number_detail_edit',obj).then(res=>{
  192. if(res.code==200){
  193. this.initData(this.proxyData);
  194. }
  195. })
  196. },
  197. search(row){
  198. this.proxyData = row;
  199. this.initData(row);
  200. },
  201. goAdd(type,row){
  202. //1 新增 2 编辑 3 变更 4 详情
  203. switch(type){
  204. case 1:
  205. this.$router.push({path:'/cms/Agreement/edit',query:{type}})
  206. break;
  207. case 2:
  208. case 3:
  209. case 4:
  210. this.$router.push({path:'/cms/Agreement/edit',query:{type,order_no:row.order_no}})
  211. break;
  212. case 5:
  213. this.confirmDelete({
  214. title:'删除确认?',
  215. content:"是否确定删除?",
  216. then: ()=>{
  217. this.axios.post('/api/contract_del',{order_no:row.order_no}).then(res=>{
  218. if(res.code==200){
  219. this.$Message.success(res.msg);
  220. this.initData();
  221. }
  222. })
  223. }
  224. })
  225. break;
  226. }
  227. },
  228. initData(row){
  229. let data = [];
  230. if(row){
  231. data = JSON.parse(JSON.stringify(row));
  232. data.start_time = data.start_time?Date.parse(data.start_time).toString().slice(0,10):'';
  233. data.end_time = data.end_time?Date.parse(data.end_time).toString().slice(0,10):'';
  234. }
  235. this.axios.post('/api/contract_list',{...data}).then(res=>{
  236. this.tableData = res.data.data;
  237. this.total = res.data.total
  238. })
  239. },
  240. changePage(e){
  241. this.pageIndex = e;
  242. this.initData(this.proxyData)
  243. },
  244. changeSize(e){
  245. this.pageIndex = 1;
  246. this.pageSize = e;
  247. this.initData(this.proxyData)
  248. }
  249. },
  250. beforeRouteLeave(to, from, next) {
  251. if (
  252. to.path == "/cms/Agreement/edit"
  253. ) {
  254. next();
  255. } else {
  256. from.meta.keepAlive = false;
  257. next();
  258. }
  259. }
  260. }
  261. </script>
  262. <style lang="scss" scoped>
  263. .search_form{
  264. margin-top:15px;
  265. display: flex;
  266. flex-wrap: wrap;
  267. }
  268. .table_top{
  269. display: flex;
  270. flex-direction: row-reverse;
  271. margin-bottom: 10px;
  272. }
  273. .content_body_page{
  274. text-align: center;
  275. margin-top: 10px;
  276. }
  277. .form_item{
  278. width:200px
  279. }
  280. </style>