12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034 |
- <template>
- <div>
- <Toptitle :title="$route.query.type==1?'新增入库单':$route.query.type==2?'查看入库单':'编辑入库单'">
- <slot name="titleButton">
- <Button @click="handleReference(5,1)"
- type="primary"
- ghost
- style="margin-right:10px;"
- v-show="!isCheck"
- :disabled='$route.query.is_refer == 0?true:btn1_disable'>参照采购单</Button>
- <Button @click="handleReference(6,2)"
- type="primary"
- ghost
- style="margin-right:10px;"
- v-show="!isCheck"
- :disabled="$route.query.is_refer == 0?true:btn2_disable">参照到货单</Button>
- <Button @click="handleReference(7,3)"
- type="primary"
- ghost
- style="margin-right:10px;"
- v-show="!isCheck"
- :disabled="$route.query.is_refer == 0?true:btn3_disable">参照质检单</Button>
- <Button @click="goBack"
- type="primary"
- ghost
- style="margin-right:10px;">返回</Button>
- <Button @click="postData"
- type="primary"
- ghost
- v-show="!isCheck"
- style="margin-right:10px;">确定</Button>
- </slot>
- </Toptitle>
- <div class="content_topform">
- <Form :label-width="90"
- :model="searchData">
- <FormItem label="项目名称:">
- <Input type="text"
- size="small"
- v-model="searchData.residential_name"
- v-show="!isCheck"
- style="width: 200px;margin-top:6px"
- placeholder="项目名称">
- <span slot="append"
- style="cursor:pointer;"
- @click="showProjectModal=true">选择</span>
- </Input>
- <span v-show="isCheck">{{searchData.residential_name}}</span>
- </FormItem>
- <FormItem label="供应商名称:">
- <Input type="text"
- size="small"
- v-model="searchData.supply_title"
- style="width: 200px;margin-top:6px"
- v-show="!isCheck"
- placeholder="供应商名称">
- <span slot="append"
- style="cursor:pointer;"
- @click="showSupplierModal=true">选择</span>
- </Input>
- <span v-show="isCheck">{{searchData.supply_title}}</span>
- </FormItem>
- <FormItem label="仓库:">
- <Select v-model="searchData.warehouse_id"
- size="small"
- clearable
- filterable
- label-in-value
- v-show="!isCheck"
- style="width: 200px">
- <Option v-for="(sitem) in warehouseList"
- :key="sitem.id"
- :label="sitem.title"
- :value="sitem.id">
- </Option>
- </Select>
- <span v-show="isCheck">{{searchData.warehouse_title}}</span>
- </FormItem>
- <FormItem label="单据号:">
- <Input type="text"
- size="small"
- readonly
- v-show="!isCheck"
- v-model="searchData.order_in_no"
- style="width: 200px"
- placeholder="自动生成" />
- <span v-show="isCheck">{{searchData.order_in_no}}</span>
- </FormItem>
- <FormItem label="入库类型:">
- <Select v-model="searchData.type_id"
- size="small"
- clearable
- filterable
- v-show="!isCheck"
- label-in-value
- style="width: 200px">
- <Option v-for="(sitem) in purchaseTypeList"
- :key="sitem.id"
- :label="sitem.title"
- :value="sitem.id">
- </Option>
- </Select>
- <span v-show="isCheck">{{searchData.type_id == 1 ?'采购入库':'库存入库'}}</span>
- </FormItem>
- <!-- <FormItem label="制单人:">
- <Input type="text"
- size="small"
- v-model="searchData.nickname"
- style="width: 200px"
- placeholder="制单人" />
- </FormItem> -->
- <FormItem label="制单日期:">
- <DatePicker type="date"
- size="small"
- style="width: 200px"
- v-show="!isCheck"
- placeholder="年/月/日"
- v-model="searchData.crt_time"></DatePicker>
- <span v-show="isCheck">{{func.replaceDate(searchData.crt_time)}}</span>
- </FormItem>
- <FormItem label="备注:">
- <Input type="textarea"
- size="small"
- v-model="searchData.remark"
- v-show="!isCheck"
- style="width: 200px"
- placeholder="备注" />
- <span v-show="isCheck">{{searchData.remark}}</span>
- </FormItem>
- </Form>
- </div>
- <div class="content_table">
- <div class="content_table_btn">
- <div>
- <span>入库清单</span>
- <Button @click="showModal=true"
- type="primary"
- size="small"
- style="margin-left:10px;"
- v-show="!isCheck"
- :disabled="$route.query.is_refer == 1?true:btn_disable">选择物料</Button>
- </div>
- <div class="content_table_btn_right">
- </div>
- </div>
- <Table :columns="tableColumns"
- border
- :data="tableData"
- show-summary :summary-method="handleSummary"
- >
- <template slot="numberSet" slot-scope="{row , index }">
- <Tooltip
- placement="left"
- @on-popper-show="handleToolShow(index, row)"
- >
- <div slot="content">
- <div>
- <div v-for="(_item,_index) in warehouse" :key="_index">
- {{_item.warehouse_title}}:{{_item.num}}
- </div>
- </div>
- </div>
- <Input
- type="text"
- v-show="!isCheck"
- size="small"
- v-model="tableData[index].num"
- placeholder="数量"
- >
- </Input>
- <span v-show="isCheck">{{ tableData[index].num }}</span>
- </Tooltip>
- </template>
- <template slot="setSlot"
- slot-scope="{row,index}">
- <a style="margin:0 5px"
- :disabled="row.state==0"
- @click="handleSet(4,row,index)">删除</a>
- </template>
- </Table>
- </div>
- <Modal v-model="showModal"
- title="选择物料"
- width='80'
- @on-ok="handleSelect"
- @on-cancel="showModal=false">
- <div class="modal_content">
- <div class="modal_content_left">
- <Tree :data="modalData.treeData"
- children-key='list'
- style="width:100%;"
- @on-select-change="handleTreeSlect"
- class="demo-tree-render"></Tree>
- </div>
- <div class="modal_content_center">
- <div class="modal_content_center_top">
- <div><span>物料名称:</span>
- <Input type="text"
- v-model="modalData.title"
- placeholder="请输入物料名称" />
- </div>
- <Button @click="initModal()"
- type="primary"
- style="margin:0 10px;">搜索</Button>
- </div>
- <div class="modal_content_center_body">
- <Table :columns="modalTableColumns"
- height="520"
- border
- ref="modelTable"
- @on-select-all="handleSelectionAll"
- @on-select-all-cancel="handleSelectionAllCancel"
- @on-select="handleSelection"
- @on-select-cancel="handleSelectionCancel"
- :loading="modalTableLoading"
- :data="modalData.tableData">
- </Table>
- <div class="modal_content_center_footer">
- <Page :page-size-opts="[10, 20, 30, 40,100]"
- @on-page-size-change='changeModalSize'
- @on-change='changeModalPage'
- :current='modal_page_index'
- show-total
- :total="modal_total"
- show-sizer
- :page-size='modal_page_size' />
- </div>
- </div>
- </div>
- <div class="modal_content_right">
- <span>已选</span>
- <Table :columns="selectedColumns"
- max-height="500"
- border
- :data="modalData.selectedData">
- <template slot="selectedSetSlot"
- slot-scope="{row,index}">
- <a style="margin:0 5px;color:red"
- @click="handleSelectedDele(row,index)">删除</a>
- </template>
- </Table>
- </div>
- </div>
- </Modal>
- <Modal v-model="showProjectModal"
- title="选择项目"
- width='80'
- @on-ok="handleProjectSelect"
- @on-cancel="showProjectModal=false">
- <div class="modal_content">
- <div class="modal_content_center">
- <div class="modal_content_center_top">
- <span>项目名称:</span>
- <Input type="text"
- v-model="modalProjectData.title"
- style="width:180px"
- placeholder="请输入物料名称" />
- <Button @click="initProjectModal()"
- type="primary"
- style="margin:0 10px;">搜索</Button>
- </div>
- <div class="modal_content_center_body">
- <Table :columns="modalProjectTableColumns"
- height="520"
- border
- :loading="modalProjectTableLoading"
- :data="modalProjectData.tableData">
- <template slot="basicTypeSet"
- slot-scope="{row}">
- <div>
- <span v-for="item in warningList"
- :key="item.id"
- :style="{color:item.color}"
- v-show="item.id==row.warning_state">{{item.title}}</span>
- </div>
- </template>
- </Table>
- <div class="modal_content_center_footer">
- <Page :page-size-opts="[10, 20, 30, 40,100]"
- @on-page-size-change='changeProjectModalSize'
- @on-change='changeProjectModalPage'
- :current='modal_project_page_index'
- show-total
- :total="modal_project_total"
- show-sizer
- :page-size='modal_project_page_size' />
- </div>
- </div>
- </div>
- </div>
- </Modal>
- <Modal v-model="showSupplierModal"
- title="选择供应商"
- width='80'
- @on-ok="handleSupplierSelect"
- @on-cancel="showSupplierModal=false">
- <div class="modal_content">
- <div class="modal_content_left">
- <Tree :data="modalSupplierData.treeData"
- children-key='sub'
- style="width:100%;"
- @on-select-change="handleSupplierTreeSlect"
- class="demo-tree-render"></Tree>
- </div>
- <div class="modal_content_center">
- <div class="modal_content_center_top">
- <span>供应商名称:</span>
- <Input type="text"
- v-model="modalSupplierData.title"
- style="width:180px"
- placeholder="请输入供应商名称" />
- <Button @click="initSupplierModal(modalSupplierData)"
- type="primary"
- style="margin:0 10px;">搜索</Button>
- </div>
- <div class="modal_content_center_body">
- <Table :columns="modalSupplierTableColumns"
- height="520"
- border
- :loading="modalSupplierTableLoading"
- :data="modalSupplierData.tableData">
- </Table>
- <div class="modal_content_center_footer">
- <Page :page-size-opts="[10, 20, 30, 40,100]"
- @on-page-size-change='changeSupplierModalSize'
- @on-change='changeSupplierModalPage'
- :current='modal_supplier_page_index'
- show-total
- :total="modal_supplier_total"
- show-sizer
- :page-size='modal_supplier_page_size' />
- </div>
- </div>
- </div>
- </div>
- </Modal>
- </div>
- </template>
- <script>
- // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
- // 例如:import 《组件名称》 from '《组件路径》';
- export default {
- name: '',
- components: {
- },
- props: {},
- // import引入的组件需要注入到对象中才能使用
- data () {
- // 这里存放数据
- return {
- isCheck:false,
- btn1_disable:false,
- btn_disable:false,
- btn2_disable:false,
- btn3_disable:false,
- fax_modify: '',
- searchData: {
- residential_name: ''
- },
- modalProjectData: {
- title: '',
- tableData: [{}]
- },
- modalSupplierData: {
- title: '',
- code: '',
- treeData: [
- {
- title: '供应商分类',
- expand: true,
- sub: [],
- render: (h, { root, node, data }) => {
- return h('span', {
- style: {
- display: 'inline-block',
- width: '100%'
- }
- }, [
- h('span', [
- h('Icon', {
- props: {
- type: 'ios-folder-outline'
- },
- style: {
- marginRight: '8px'
- }
- }),
- h('span', data.title)
- ]),
- h('span', {
- style: {
- display: 'inline-block',
- // float: 'right',
- marginRight: '32px'
- }
- })
- ]);
- },
- }
- ],
- tableData: [{}]
- },
- tableColumns: [
- { title: '物料分类', key: 'type_title', align: 'center', minWidth: 140 },
- { title: '物料名称', key: 'title', align: 'center', minWidth: 140 },
- {
- title: '物料规格', key: '', 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)
- }
- },
- { title: '计量单位', key: 'unit', align: 'center', minWidth: 100 },
- {
- 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]))
- // return this.$route.query.type == 2 ? h('span', {}, currentRow.num)
- // : h('Input', {
- // props: {
- // value: currentRow.num,
- // type: 'text'
- // },
- // on: {
- // 'on-change': (e) => {
- // currentRow.num = e.target.value
- // // currentRow.total_price = (1 * currentRow.price * currentRow.num).toFixed(2)
- // // currentRow.no_tax_amount = (1 * currentRow.no_tax_price * currentRow.num).toFixed(2)
- // // currentRow.tax_amount = (1 * currentRow.total_price - 1 * currentRow.no_tax_amount).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]))
- return this.$route.query.type == 2 ? h('span', {}, currentRow.total_price)
- :
- h('Input', {
- props: {
- value: currentRow.total_price,
- type: 'text'
- },
- on: {
- 'on-change': (e) => {
- currentRow.total_price = e.target.value
- this.tableData.splice(index, 1, currentRow);
- }
- }
- })
- }
- },
- {
- title: "金额", key: "total", align: "center", minWidth: 100,
- render: (h, params) => {
- const { row, index } = params;
- const currentRow = JSON.parse(
- JSON.stringify(this.tableData[index])
- );
-
- return h("span", {},currentRow.total_price&¤tRow.num?currentRow.total_price*currentRow.num:0)
- }
- },
- { title: '操作', key: 'code', align: 'center', minWidth: 100, slot: 'setSlot' },
- ],
- is_refer:'',
- tableData: [],
- showModal: false,
- showProjectModal: false,
- showSupplierModal: false,
- modalTableLoading: false,
- modalProjectTableLoading: false,
- modalSupplierTableLoading: false,
- modal_project_page_index: 1,
- modal_project_page_size: 10,
- modal_project_total: 0,
- modal_supplier_page_index: 1,
- modal_supplier_page_size: 10,
- modal_supplier_total: 0,
- currentChoose: {},
- modalProjectTableColumns: [
- {
- title: '选择', key: '', align: 'center', minWidth: 60,
- render: (h, params) => {
- let id = params.row.id;
- let flag = false;
- if (this.currentChoose.id == id) {
- flag = true
- } else {
- flag = false
- }
- let self = this
- return h('div', [
- h('Radio', {
- props: {
- value: flag
- },
- on: {
- 'on-change': () => {
- self.currentChoose = params.row;
- }
- }
- })
- ])
- }
- },
- { title: '项目名称', key: 'residential_name', align: 'center', minWidth: 100 },
- { title: '紧急程度', align: 'center', key: 'warning_state', minWidth: 80, slot: 'basicTypeSet', },
- {
- title: '创建时间', key: 'crt_time', align: 'center', minWidth: 110,
- render: (h, params) => {
- const { row } = params
- return h('span', {}, this.func.replaceDate(row.crt_time))
- }
- },
- ],
- modalSupplierTableColumns: [
- {
- title: '选择', key: '', align: 'center', minWidth: 60,
- render: (h, params) => {
- let id = params.row.id;
- let flag = false;
- if (this.currentChoose.id == id) {
- flag = true
- } else {
- flag = false
- }
- let self = this
- return h('div', [
- h('Radio', {
- props: {
- value: flag
- },
- on: {
- 'on-change': () => {
- self.currentChoose = params.row;
- }
- }
- })
- ])
- }
- },
- { title: '供应商编码', key: 'code', align: 'center', minWidth: 100 },
- { title: '供应商名称', key: 'title', align: 'center', minWidth: 80, },
- { title: '负责人', key: 'contact', align: 'center', minWidth: 110, },
- { title: '联系方式', key: 'mobile', align: 'center', minWidth: 110, },
- ],
- modalData: {
- title: '',
- tableData: [{}],
- selectedData: [],
- treeData: [
- {
- title: '物料分类',
- expand: true,
- list: [],
- render: (h, { root, node, data }) => {
- return h('span', {
- style: {
- display: 'inline-block',
- width: '100%'
- }
- }, [
- h('span', [
- h('Icon', {
- props: {
- type: 'ios-folder-outline'
- },
- style: {
- marginRight: '8px'
- }
- }),
- h('span', data.title)
- ]),
- h('span', {
- style: {
- display: 'inline-block',
- // float: 'right',
- marginRight: '32px'
- }
- })
- ]);
- },
- }
- ],
- },
- selectedColumns: [
- { title: '物料名称', key: 'title', align: 'center', minWidth: 110 },
- { title: '操作', key: 'title', align: 'center', minWidth: 90, slot: 'selectedSetSlot' },
- ],
- modal_page_index: 1,
- modal_page_size: 10,
- modal_total: 0,
- modalTableColumns: [
- { title: '全选', type: 'selection', align: 'center', minWidth: 60 },
- { title: '物料名称', key: 'title', align: 'center', minWidth: 110 },
- { title: '物料规格', key: 'model', align: 'center', minWidth: 110 },
- { title: '计量单位', key: 'unit', align: 'center', minWidth: 110 },
- ],
- warehouseList: [],
- purchaseTypeList: [],
- warningList: [],
- warehouse:'',
- }
- },
- // 生命周期 - 创建完成(可以访问当前this实例)
- created () {
- this.$route.query.type == 2
- ? (this.isCheck = true)
- : (this.isCheck = false);
- // 获取采购类型
- this.axios({ method: 'get', url: '/api/basic_order_in_list', }).then((res) => { this.purchaseTypeList = res.data.data }).catch((err) => { });
- // 获取基础物料类型
- this.axios({ method: 'get', url: '/api/basics_material_index_level', }).then((res) => { this.modalData.treeData[0].list = res.data }).catch((err) => { });
- // 获取仓库列表
- this.axios({ method: 'get', url: '/api/warehouse', }).then((res) => { this.warehouseList = res.data }).catch((err) => { });
- // 获取供应商列表
- 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
- }).catch((err) => { });
- // 获取紧急程度
- this.axios.get('/api/warning_list').then(res => { this.warningList = res.data.data })
- this.initModal()
- this.initProjectModal()
- this.initSupplierModal(this.modalSupplierData)
- },
- // 生命周期 - 挂载完成(可以访问DOM元素)
- mounted () {
- if (this.$route.query.order_in_no != '') {
- this.initData(this.$route.query.order_in_no)
- }
- },
- methods: {
- handleToolShow(index, row) {
- if (this.warehouse) {
- return
- } else {
- this.axios
- .get("/api/warehouse_stock_number", {
- params: {
- material_id: row.material_id,
- material_detail_id: row.material_detail_id,
- },
- })
- .then((res) => {
- this.warehouse= res.data
- });
- }
-
- // this.warehouse.num = this.warehouseTotal[index].num;
- // this.warehouse.warehouseName = this.warehouseTotal[index].warehouseName
-
- },
- handleSummary ({ columns, data }) {
- const sums = {};
- columns.forEach((column, index) => {
- const key = column.key;
- if (index === 0) {
- sums[key] = {
- key,
- value: '总价'
- };
- return;
- }
- let val = data;
- for(let i in val){
- val[i].total = val[i].total_price*val[i].num;
- }
- const values = val.map(item => Number(item[key]));
- if (index === 6) {
- const v = values.reduce((prev, curr) => {
- const value = Number(curr);
- if (!isNaN(value)) {
- return prev + curr;
- } else {
- return prev;
- }
- }, 0);
- sums[key] = {
- key,
- value: v
- };
- }else if(index===4){
- const v = values.reduce((prev, curr) => {
- const value = Number(curr);
- if (!isNaN(value)) {
- return prev + curr;
- } else {
- return prev;
- }
- }, 0);
- sums[key] = {
- key,
- value: v
- };
- }
- else {
- sums[key] = {
- key,
- value: ''
- };
- }
- });
- return sums;
- },
- initData (order_in_no) {
- this.axios({
- method: 'get',
- url: '/api/warehouse_order_in_detail',
- params: { order_in_no }
- }).then((res) => {
- this.tableData = res.data.list
- const data = JSON.parse(JSON.stringify(res.data))
- delete data.list
- this.searchData = data
- console.log(this.searchData)
- }).catch((err) => { });
- },
- postData () {
- this.tableData.forEach(element => {
- if (element.type != 0) {
- this.searchData.type = 1
- } else {
- this.searchData.type = 0
- }
- });
- let obj = JSON.parse(JSON.stringify(this.searchData))
- obj.crt_time = parseInt(new Date(obj.crt_time).getTime() / 1000) || ''
- if (this.$route.query.order_in_no == '') {
- // 新增
- this.axios({
- method: 'post',
- url: '/api/warehouse_order_in_add',
- data: {
- ...obj,
- list: this.tableData,
- is_refer:this.is_refer
- }
- }).then((res) => {
- this.$Message.success(res.msg)
- this.goBack();
- }).catch((err) => { });
- } else {
- // 编辑
- this.axios({
- method: 'post',
- url: '/api/warehouse_order_in_edit',
- data: {
- order_in_no: this.$route.query.order_in_no,
- ...obj,
- list: this.tableData,
- is_refer:this.is_refer
- }
- }).then((res) => {
- this.$Message.success(res.msg)
- this.goBack();
- }).catch((err) => { });
- }
- },
- handleReference (type, refer_type) {
- let title = type == 5 ? '参照采购单' : type == 6 ? '参照到货单' : '参照质检单'
- this.$reference({
- type,
- title, refer_type,
- then: (result, data) => {
- this.tableData = [...this.tableData, ...result]
- this.is_refer = 1
- this.btn_disable = true
- if(type === 5){
- this.btn2_disable = true
- this.btn3_disable = true
- }
- else if(type === 6){
- this.btn1_disable = true
- this.btn3_disable = true
- }else{
- this.btn1_disable = true
- this.btn2_disable = true
- }
- }
- })
- },
- handleSet (type, row, index) {
- this.tableData.splice(index, 1)
- },
- handleSelect () {
- this.modalData.selectedData.forEach(element => {
- element.type_title = element.title
- element.type == 0
- });
- this.tableData = [...this.tableData, ...this.modalData.selectedData]
- this.is_refer = 0
- this.btn1_disable = true
- this.btn2_disable = true
- this.btn3_disable = true
- },
- handleTreeSlect (array, row) {
- row.id && this.axios({
- method: 'get',
- url: '/api/material_detail_list',
- params: {
- page_index: this.modal_page_index,
- page_size: this.modal_page_size,
- m_id: row.id
- }
- }).then((res) => {
- this.modal_total = res.data.total
- this.modalData.tableData = res.data.data
- }).catch((err) => { });
- },
- handleSelectionCancel (selection, row) {
- this.modalData.selectedData.forEach((element, index) => {
- if (element.material_detail_id == row.material_detail_id) {
- this.modalData.selectedData.splice(index, 1)
- }
- });
- },
- handleSelectionAll (selection) {
- this.modalData.selectedData = this.modalData.selectedData.concat(selection)
- },
- handleSelectionAllCancel () {
- this.modalData.tableData.forEach(element => {
- this.modalData.selectedData = this.modalData.selectedData.filter((x) => {
- return x.material_detail_id != element.material_detail_id
- })
- });
- },
- reselection () {
- this.modalData.selectedData.forEach(element => {
- this.modalData.tableData.forEach((ele, idx) => {
- if (element.material_detail_id == ele.material_detail_id) {
- this.$nextTick(() => {
- this.$refs.modelTable.$refs.tbody.objData[idx]._isChecked = true
- this.$forceUpdate()
- })
- }
- });
- });
- },
- changeModalSize (e) {
- this.modal_page_size = e;
- this.initModal()
- },
- changeModalPage (e) {
- this.modal_page_index = e;
- this.initModal()
- },
- initModal () {
- this.axios({
- method: 'get',
- url: '/api/material_detail_list',
- params: {
- page_index: this.modal_page_index,
- page_size: this.modal_page_size,
- title: this.modalData.title
- }
- }).then((res) => {
- this.modal_total = res.data.total
- this.modalData.tableData = res.data.data
- this.reselection()
- }).catch((err) => { });
- },
- handleSelection (selection, row) {
- this.modalData.selectedData.push(row)
- },
- handleSelectedDele (row, index) {
- this.modalData.selectedData.splice(index, 1)
- },
- goBack () { this.$router.go(-1) },
- handleProjectSelect () {
- this.searchData.residential_name = this.currentChoose.residential_name
- this.searchData.order_no = this.currentChoose.order_no
- },
- handleSupplierSelect () {
- this.searchData.supply_title = this.currentChoose.title
- this.searchData.supply_id = this.currentChoose.id
- },
- changeProjectModalSize (e) {
- this.modal_project_page_size = e
- this.initProjectModal()
- },
- changeProjectModalPage (e) {
- this.modal_project_page_index = e
- this.initProjectModal()
- },
- 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) => { });
- },
- changeSupplierModalSize (e) {
- this.modal_supplier_page_size = e
- this.initSupplierModal(this.modalSupplierData)
- },
- changeSupplierModalPage (e) {
- this.modal_supplier_page_index = e
- this.initSupplierModal(this.modalSupplierData)
- },
- initSupplierModal (searchData) {
- this.axios({
- method: 'get',
- url: '/api/supply_list',
- params: {
- page_index: this.modal_supplier_page_index,
- page_size: this.modal_supplier_page_size,
- title: searchData.title,
- code: searchData.code,
- }
- }).then((res) => {
- this.modal_supplier_total = res.data.total
- this.modalSupplierData.tableData = res.data.data
- }).catch((err) => { });
- },
- handleSupplierTreeSlect (arr, row) {
- this.modalSupplierData.code = row.code
- this.initSupplierModal(this.modalSupplierData)
- },
- },
- // 监听属性 类似于data概念
- computed: {},
- // 监控data中的数据变化
- watch: {},
- beforeCreate () { }, // 生命周期 - 创建之前
- beforeMount () { }, // 生命周期 - 挂载之前
- beforeUpdate () { }, // 生命周期 - 更新之前
- updated () { }, // 生命周期 - 更新之后
- beforeDestroy () { }, // 生命周期 - 销毁之前
- destroyed () { }, // 生命周期 - 销毁完成
- activated () { }, // 如果页面有keep-alive缓存功能,这个函数会触发
- }
- </script>
- <style lang='scss' scoped>
- .content_topform {
- padding-top: 20px;
- /deep/.ivu-form {
- display: flex;
- justify-content: flex-start;
- align-items: flex-start;
- flex-wrap: wrap;
- }
- /deep/.ivu-form-item {
- display: inline-block;
- width: 300px;
- }
- }
- .content_table {
- .content_table_btn {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding-bottom: 20px;
- }
- .content_table_btn_right {
- display: flex;
- justify-content: flex-start;
- align-items: center;
- }
- }
- .modal_content {
- display: flex;
- justify-content: center;
- overflow: hidden;
- overflow-y: auto;
- .modal_content_left {
- }
- .modal_content_center {
- width: 80%;
- border-left: 1px solid #666;
- border-right: 1px solid #666;
- padding: 0 20px;
- .modal_content_center_top {
- display: flex;
- justify-content: flex-start;
- align-items: center;
- span {
- width: 100px;
- }
- div {
- display: flex;
- justify-content: space-around;
- align-items: center;
- span {
- width: 100px;
- }
- }
- .modal_content_center_body {
- overflow: hidden;
- overflow-y: auto;
- height: 500px;
- }
- }
- .modal_content_center_body {
- padding-top: 20px;
- }
- .modal_content_center_footer {
- display: flex;
- justify-content: center;
- padding-top: 20px;
- }
- }
- .modal_content_right {
- width: 30%;
- padding: 0 20px;
- }
- }
- /deep/ .ivu-table-wrapper {
- overflow: visible;
- } //穿透iview
- </style>
|