list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <template>
  2. <div class="qualitycontrol_order">
  3. <Toptitle title="质检列表">
  4. <slot name="titleButton">
  5. <Button type="primary"
  6. @click="handleGoPage(1,'')"
  7. style="margin-right:10px;">新增</Button>
  8. <!-- <Button @click="handleCodeRule"
  9. type="primary"
  10. ghost
  11. style="margin-right:10px;">编码规则</Button> -->
  12. </slot>
  13. </Toptitle>
  14. <div class="qualitycontrol_order_search">
  15. <Form :label-width="90"
  16. :model="searchData">
  17. <FormItem label="订单号:">
  18. <Input type="text"
  19. size="small"
  20. v-model="searchData.order_no"
  21. style="width: 150px"
  22. placeholder="订单号" />
  23. </FormItem>
  24. <!-- <FormItem label="项目名称:">
  25. <Input type="text"
  26. size="small"
  27. v-model="searchData.project_title"
  28. style="width: 150px"
  29. placeholder="项目名称" />
  30. </FormItem> -->
  31. <!-- <FormItem label="紧急程度:">
  32. <Select v-model="searchData.warning_state"
  33. size="small"
  34. clearable
  35. style="width: 150px">
  36. <Option v-for="_item in warningList"
  37. :key="_item.id"
  38. :value="_item.id"
  39. :label="_item.title"></Option>
  40. </Select>
  41. </FormItem> -->
  42. <!-- <FormItem label="业务员:">
  43. <Select v-model="searchData.man"
  44. size="small"
  45. clearable
  46. style="width: 150px">
  47. <Option v-for="(sitem) in userList"
  48. :key="sitem.id"
  49. :label="sitem.nickname"
  50. :value="sitem.id">
  51. </Option>
  52. </Select>
  53. </FormItem> -->
  54. <FormItem label="提交人:">
  55. <Select v-model="searchData.user_id"
  56. size="small"
  57. clearable
  58. style="width: 150px">
  59. <Option v-for="(sitem) in userList"
  60. :key="sitem.id"
  61. :label="sitem.nickname"
  62. :value="sitem.id">
  63. </Option>
  64. </Select>
  65. </FormItem>
  66. <FormItem label="审批状态:">
  67. <Select v-model="searchData.state"
  68. size="small"
  69. clearable
  70. style="width: 150px">
  71. <Option label='未提交'
  72. :value=0 />
  73. <Option label='审核中'
  74. :value=1 />
  75. <Option label='通过'
  76. :value=2 />
  77. <Option label='驳回'
  78. :value=3 />
  79. </Select>
  80. </FormItem>
  81. <FormItem label="制单时间:">
  82. <DatePicker type="date"
  83. size="small"
  84. style="width: 150px"
  85. placeholder="年/月/日"
  86. v-model="searchData.start_time"></DatePicker>
  87. </FormItem>
  88. <FormItem label="~">
  89. <DatePicker type="date"
  90. size="small"
  91. style="width: 150px"
  92. placeholder="年/月/日"
  93. v-model="searchData.end_time"></DatePicker>
  94. </FormItem>
  95. <FormItem>
  96. <Button type="primary"
  97. size="small"
  98. @click="initData(searchData)"
  99. style="margin-right:10px;">搜索</Button>
  100. </FormItem>
  101. </Form>
  102. <div class="content_right_topfrom_btn">
  103. </div>
  104. </div>
  105. <div class="qualitycontrol_order_content">
  106. <div class="qualitycontrol_order_content_table">
  107. <Table :columns="tableColumns"
  108. border
  109. :max-height="500"
  110. :data="tableData">
  111. <template slot="setSlot"
  112. slot-scope="{row,index}">
  113. <a style="margin:0 5px"
  114. @click="handleSet(2,row,index)">详情</a>
  115. <a style="margin:0 5px"
  116. :disabled="row.state==1||row.state==2"
  117. @click="handleSet(3,row,index)">编辑</a>
  118. <a style="margin:0 5px"
  119. :disabled="row.state==1||row.state==2"
  120. @click="handleSet(4,row,index)">删除</a>
  121. <a style="margin:0 5px"
  122. :disabled="row.state==1||row.state==2"
  123. @click="handleSet(5,row,index)">提交</a>
  124. </template>
  125. </Table>
  126. <div class="qualitycontrol_order_content_page">
  127. <Page :page-size-opts="[10, 20, 30, 40,100]"
  128. @on-page-size-change='changeSize'
  129. @on-change='changePage'
  130. :current='pageIndex'
  131. show-total
  132. :total="total"
  133. show-sizer
  134. :page-size='pageSize' />
  135. </div>
  136. </div>
  137. </div>
  138. </div>
  139. </template>
  140. <script>
  141. // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  142. // 例如:import 《组件名称》 from '《组件路径》';
  143. export default {
  144. name: '',
  145. components: {
  146. },
  147. props: {},
  148. // import引入的组件需要注入到对象中才能使用
  149. data () {
  150. // 这里存放数据
  151. return {
  152. searchData: {
  153. order_no: '',
  154. project_title: '',
  155. supply_title: '',
  156. type_id: '',
  157. user_id: '',
  158. lock: '',
  159. state: '',
  160. start_time: '',
  161. end_time: '',
  162. },
  163. tableColumns: [
  164. { title: '订单号', key: 'purchase_order_quality_no', align: 'center', minWidth: 140 },
  165. // { title: '项目名称', key: 'client_name', align: 'center', minWidth: 140 },
  166. { title: '供应商名称', key: 'supply_title', align: 'center', minWidth: 140 },
  167. { title: '提交人', key: 'nickname', align: 'center', minWidth: 100 },
  168. {
  169. title: '审批状态', key: 'state', align: 'center', minWidth: 140,
  170. render: (h, params) => {
  171. const { row } = params
  172. const text = row.state == 0 ? '未提交' : row.state == 1 ? '审核中' : row.state == 2 ? '通过' : '驳回'
  173. return h('span', {}, text)
  174. }
  175. },
  176. {
  177. title: '制单日期', key: 'crt_time', align: 'center', minWidth: 140,
  178. render: (h, params) => {
  179. const { row } = params
  180. return h('span', {}, this.func.replaceDate(row.crt_time))
  181. }
  182. },
  183. { title: '操作', key: 'code', align: 'center', minWidth: 200, slot: 'setSlot' },
  184. ],
  185. tableData: [{}],
  186. pageIndex: 1,
  187. pageSize: 10,
  188. total: 0,
  189. userList: [],
  190. warningList: [],
  191. }
  192. },
  193. // 生命周期 - 创建完成(可以访问当前this实例)
  194. created () {
  195. // 获取操作员
  196. this.axios('/api/user').then(res => this.userList = res.data.data)
  197. // 获取紧急程度
  198. this.axios.get('/api/warning_list').then(res => { this.warningList = res.data.data })
  199. },
  200. // 生命周期 - 挂载完成(可以访问DOM元素)
  201. mounted () {
  202. this.initData()
  203. },
  204. beforeRouteEnter(to,from,next){
  205. next(vm=>{
  206. if(from.name === 'QualitycontrolOrderEdit'){
  207. vm.initData()
  208. }
  209. })
  210. },
  211. methods: {
  212. initData () {
  213. let obj = JSON.parse(JSON.stringify(this.searchData))
  214. obj.start_time = parseInt(new Date(obj.start_time).getTime() / 1000) || ''
  215. obj.end_time = parseInt(new Date(obj.end_time).getTime() / 1000) || ''
  216. this.axios({
  217. method: 'get',
  218. url: '/api/purchase_quality_list',
  219. params: {
  220. ...obj,
  221. page_index: this.pageIndex,
  222. page_size: this.pageSize,
  223. }
  224. }).then((res) => {
  225. this.tableData = res.data.data
  226. this.total = res.data.total
  227. }).catch((err) => { });
  228. },
  229. handleSet (type, row, index) {
  230. // 1新增 2详情 3编辑 4删除 5提交
  231. switch (type) {
  232. case 1:
  233. case 2:
  234. case 3:
  235. this.handleGoPage(type, row.purchase_order_quality_no)
  236. break;
  237. case 4:
  238. this.$Modal.confirm({
  239. title: '确认删除?',
  240. content: '此操作无法恢复,请确认!',
  241. onOk: () => {
  242. this.axios({
  243. method: 'post',
  244. url: '/api/purchase_quality_del',
  245. data: {
  246. purchase_order_arrive_no: row.purchase_order_quality_no
  247. }
  248. }).then((res) => {
  249. this.$Message.success(res.msg)
  250. this.initData()
  251. }).catch((err) => { });
  252. },
  253. onCancel: () => { }
  254. })
  255. break;
  256. case 5:
  257. this.$Modal.confirm({
  258. title: '确认提交?',
  259. onOk: () => {
  260. this.axios({
  261. method: 'post',
  262. url: '/api/purchase_quality_pull',
  263. data: {
  264. purchase_order_quality_no: row.purchase_order_quality_no,
  265. lock: row.lock,
  266. state: row.state + 1
  267. }
  268. }).then((res) => {
  269. this.$Message.success(res.msg)
  270. this.initData()
  271. }).catch((err) => { });
  272. },
  273. onCancel: () => { }
  274. })
  275. break;
  276. }
  277. },
  278. handleGoPage (type, purchase_order_quality_no) {
  279. this.$router.push({
  280. path: '/cms/PurchasingManage/qualitycontrolOrder/edit',
  281. query: {
  282. type,
  283. purchase_order_quality_no
  284. }
  285. })
  286. },
  287. changeSize (e) {
  288. this.pageSize = e;
  289. this.initData()
  290. },
  291. changePage (e) {
  292. this.pageIndex = e;
  293. this.initData()
  294. }
  295. },
  296. // 监听属性 类似于data概念
  297. computed: {},
  298. // 监控data中的数据变化
  299. watch: {},
  300. beforeCreate () { }, // 生命周期 - 创建之前
  301. beforeMount () { }, // 生命周期 - 挂载之前
  302. beforeUpdate () { }, // 生命周期 - 更新之前
  303. updated () { }, // 生命周期 - 更新之后
  304. beforeDestroy () { }, // 生命周期 - 销毁之前
  305. destroyed () { }, // 生命周期 - 销毁完成
  306. activated () { }, // 如果页面有keep-alive缓存功能,这个函数会触发
  307. }
  308. </script>
  309. <style lang='scss' scoped>
  310. .qualitycontrol_order_search {
  311. padding-top: 20px;
  312. /deep/.ivu-form {
  313. display: flex;
  314. justify-content: flex-start;
  315. flex-wrap: wrap;
  316. }
  317. /deep/.ivu-form-item {
  318. display: inline-block;
  319. width: 250px;
  320. }
  321. }
  322. .qualitycontrol_order_content {
  323. border-top: 1px solid #f4f4f4;
  324. margin-top: 20px;
  325. .qualitycontrol_order_content_btn {
  326. display: flex;
  327. justify-content: flex-end;
  328. padding: 20px 0;
  329. }
  330. .qualitycontrol_order_content_page {
  331. display: flex;
  332. justify-content: center;
  333. padding-top: 20px;
  334. }
  335. // .qualitycontrol_order_content_table{
  336. // max-height: 400px;
  337. // overflow: hidden;
  338. // overflow-y: auto;
  339. // }
  340. }
  341. </style>