123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348 |
- <template>
- <div class="requisition_order">
- <Toptitle title="请购列表">
- <slot name="titleButton">
- <!-- <Button @click="handleCodeRule"
- type="primary"
- ghost
- style="margin-right:10px;">编码规则</Button> -->
- <Button type="primary"
- @click="handleGoPage(1,'')"
- style="margin-right:10px;">新增</Button>
- </slot>
- </Toptitle>
- <div class="requisition_order_search">
- <Form :label-width="90"
- :model="searchData">
- <FormItem label="订单号:">
- <Input type="text"
- size="small"
- clearable
- v-model="searchData.order_no"
- style="width: 150px"
- placeholder="订单号" />
- </FormItem>
- <FormItem label="项目名称:">
- <Input type="text"
- size="small"
- clearable
- v-model="searchData.project_title"
- style="width: 150px"
- placeholder="项目名称" />
- </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="提交人:">
- <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"
- clearable
- style="width: 150px">
- <Option label='未提交'
- :value=0 />
- <Option label='审核中'
- :value=1 />
- <Option label='通过'
- :value=2 />
- <Option label='驳回'
- :value=3 />
- </Select>
- </FormItem>
- <FormItem label="订单状态:">
- <Select v-model="searchData.lock"
- size="small"
- clearable
- style="width: 150px">
- <Option label='正常'
- :value=0 />
- <Option label='已关闭'
- :value=1 />
- </Select>
- </FormItem>
- <FormItem label="制单时间:">
- <DatePicker type="date"
- size="small"
- style="width: 150px"
- placeholder="年/月/日"
- v-model="searchData.time[0]"></DatePicker>
- </FormItem>
- <FormItem label="~">
- <DatePicker type="date"
- size="small"
- style="width: 150px"
- placeholder="年/月/日"
- v-model="searchData.time[1]"></DatePicker>
- </FormItem>
- <FormItem>
- <Button type="primary"
- size="small"
- @click="initData(searchData)"
- style="margin-right:10px;">搜索</Button>
- </FormItem>
- </Form>
- </div>
- <div class="requisition_order_content">
- <div class="requisition_order_content_table">
- <Table :columns="tableColumns"
- border
- :max-height="500"
- :data="tableData">
- <template slot="setSlot"
- slot-scope="{row,index}">
- <a style="margin:0 5px"
- @click="handleSet(2,row,index)">详情</a>
- <a style="margin:0 5px"
- :disabled="row.state==1||row.state==2"
- @click="handleSet(3,row,index)">编辑</a>
- <a style="margin:0 5px"
- :disabled="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)">提交</a>
- </template>
- </Table>
- <div class="requisition_order_content_page">
- <Page :page-size-opts="[10, 20, 30, 40,100]"
- @on-page-size-change='changeSize'
- @on-change='changePage'
- :current='pageIndex'
- show-total
- :total="total"
- show-sizer
- :page-size='pageSize' />
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
- // 例如:import 《组件名称》 from '《组件路径》';
- export default {
- name: '',
- components: {
- },
- props: {},
- // import引入的组件需要注入到对象中才能使用
- data () {
- // 这里存放数据
- return {
- searchData: {
- order_no: '',
- project_title: '',
- type_id: '',
- state: '',
- user_id: '',
- time: [],
- start_time: '',
- end_time: '',
- },
- purchaseTypeList: [],
- tableColumns: [
- { title: '订单号', key: 'purchase_order_apply_no', align: 'center', minWidth: 140 },
- { title: '项目名称', key: 'residential_name', align: 'center', minWidth: 140 },
- { title: '请购类型', key: 'type_title', align: 'center', minWidth: 140 },
- {
- title: '订单状态', key: 'lock', align: 'center', minWidth: 140,
- render: (h, params) => {
- const { row } = params
- const text = row.lock == 0 ? '正常' : '已关闭'
- return h('span', {}, text)
- }
- },
- { title: '提交人', key: 'nickname', align: 'center', minWidth: 140 },
- {
- title: '审批状态', key: 'state', align: 'center', minWidth: 140,
- render: (h, params) => {
- const { row } = params
- const text = row.state == 0 ? '未提交' : row.state == 1 ? '审核中' : row.state == 2 ? '通过' : '驳回'
- return h('span', {}, text)
- }
- },
- {
- title: '制单日期', key: 'crt_time', align: 'center', minWidth: 180,
- render: (h, params) => {
- const { row } = params
- return h('span', {}, this.func.replaceDate(row.crt_time))
- }
- },
- { title: '操作', key: 'code', align: 'center', minWidth: 200, slot: 'setSlot' },
- ],
- tableData: [{}],
- pageIndex: 1,
- pageSize: 10,
- total: 0,
- userList: []
- }
- },
- // 生命周期 - 创建完成(可以访问当前this实例)
- created () {
- // 获取采购类型
- this.axios({ method: 'get', url: '/api/basic_purchase_list', }).then((res) => { this.purchaseTypeList = res.data.data }).catch((err) => { });
- // 获取操作员
- this.axios('/api/user').then(res => this.userList = res.data.data)
- },
- // 生命周期 - 挂载完成(可以访问DOM元素)
- mounted () {
- this.initData()
- },
- beforeRouteEnter(to,from,next){
- next(vm =>{
- if(from.name === 'RequisitionOrderEdit'){
- vm.initData()
- }
- })
- },
- 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.axios({
- method: 'get',
- url: '/api/purchase_apply_list',
- params: {
- ...this.searchData
- }
- }).then((res) => {
- this.tableData = res.data.data
- this.total = res.data.total
- }).catch((err) => { });
- },
- handleSet (type, row, index) {
- // 1新增 2详情 3编辑 4删除 5提交
- switch (type) {
- case 1:
- case 2:
- case 3:
- this.handleGoPage(type, row.purchase_order_apply_no)
- break;
- case 4:
- this.$Modal.confirm({
- title: '确认删除?',
- content: '此操作无法恢复,请确认!',
- onOk: () => {
- this.axios({
- method: 'get',
- url: '/api/purchase_apply_del',
- params: {
- purchase_order_apply_no: row.purchase_order_apply_no
- }
- }).then((res) => {
- this.$Message.success(res.msg)
- this.initData()
- }).catch((err) => { });
- },
- onCancel: () => { }
- })
- break;
- case 5:
- this.$Modal.confirm({
- title: '确认提交?',
- // content: '此操作无法恢复,请确认!',
- onOk: () => {
- this.axios({
- method: 'post',
- url: '/api/purchase_apply_pull',
- data: {
- purchase_order_apply_no: row.purchase_order_apply_no,
- lock: row.lock,
- state: row.state + 1,
- }
- }).then((res) => {
- this.$Message.success(res.msg)
- this.initData()
- }).catch((err) => { });
- },
- onCancel: () => { }
- })
- break;
- }
- },
- handleGoPage (type, purchase_order_apply_no) {
- this.$router.push({
- path: '/cms/PurchasingManage/RequisitionOrder/edit',
- query: {
- type,
- purchase_order_apply_no
- }
- })
- },
- changeSize (e) {
- this.pageSize = e;
- this.initData()
- },
- changePage (e) {
- this.pageIndex = e;
- this.initData()
- }
- },
- // 监听属性 类似于data概念
- computed: {},
- // 监控data中的数据变化
- watch: {},
- beforeCreate () { }, // 生命周期 - 创建之前
- beforeMount () { }, // 生命周期 - 挂载之前
- beforeUpdate () { }, // 生命周期 - 更新之前
- updated () { }, // 生命周期 - 更新之后
- beforeDestroy () { }, // 生命周期 - 销毁之前
- destroyed () { }, // 生命周期 - 销毁完成
- activated () { }, // 如果页面有keep-alive缓存功能,这个函数会触发
- }
- </script>
- <style lang='scss' scoped>
- .requisition_order_search {
- padding-top: 20px;
- /deep/.ivu-form {
- display: flex;
- justify-content: flex-start;
- flex-wrap: wrap;
- }
- /deep/.ivu-form-item {
- display: inline-block;
- width: 250px;
- }
- }
- .requisition_order_content {
- border-top: 1px solid #f4f4f4;
- margin-top: 20px;
- .requisition_order_content_btn {
- display: flex;
- justify-content: flex-end;
- padding: 20px 0;
- }
- .requisition_order_content_page {
- display: flex;
- justify-content: center;
- padding-top: 20px;
- }
- }
- </style>
|