list.vue 11 KB

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