12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193 |
- <template>
- <zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: $route.meta.title + '-列表', essential: true }]">
- <template slot-scope="{activeKey, data}">
- <div :style="{
- width: '100%',
- height: activeKey == 'list' ? '100%' : '0px',
- overflow: 'hidden'
- }">
- <template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents"
- :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing"
- :exportList="exportList" :operation="operation()">
- </template-page>
- </div>
- <div v-if="~['add', 'detail'].indexOf(activeKey)" style="box-sizing: border-box;padding: 16px;">
- <el-tabs v-if="activeKey == 'detail'" v-model="activeType_e">
- <el-tab-pane label="基础资料" name="jbzl"></el-tab-pane>
- <el-tab-pane label="修改记录" name="xgjl"></el-tab-pane>
- </el-tabs>
- <br v-if="activeKey == 'detail'" />
- <div v-if="activeType_e == 'jbzl'">
- <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
- <zj-form-module :title="data.label" :showPackUp="false" :form-data="formData" :form-items="formItems">
- </zj-form-module>
- <zj-form-module title="" label-width="100px" :form-data="formData" :form-items="formItems2">
- <el-tabs slot="header" v-model="activeName">
- <el-tab-pane :disabled="isEditIndex > -1 ? true : false" label="辅材配置" name="items_m"></el-tab-pane>
- <el-tab-pane :disabled="isEditIndex > -1 ? true : false" label="配件配置" name="items_p"></el-tab-pane>
- </el-tabs>
- </zj-form-module>
- </zj-form-container>
- <div slot="footer" class="dialog-footer">
- <el-button size="mini" @click="data.removeTab">取 消</el-button>
- <el-button size="mini" type="primary" @click="quedingbaocun(data.removeTab)">确定</el-button>
- </div>
- </div>
- <div v-if="activeType_e == 'xgjl'">
- <zj-form-container :form-data="formData" :styleSwitch="false">
- <zj-form-module title="修改记录" :showPackUp="false" :form-data="formData" :form-items="logList">
- </zj-form-module>
- </zj-form-container>
- </div>
- </div>
- </template>
- </zj-tab-page>
- </template>
- <script>
- import TemplatePage from '@/components/template/template-page-1.vue'
- import import_mixin from '@/components/template/import_mixin.js'
- import operation_mixin from '@/components/template/operation_mixin.js'
- import ImageUpload from '@/components/file-upload'
- import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
- import { orderEnginbaseList, orderEnginBaseListExport, orderEnginBaseSave, orderEnginBaseDetail } from "@/api/basicEngineeringData";
- import { lbsAmapRegion } from '@/api/common.js'
- import geographicalPosi from '@/components/geographicalPosi/index.vue'
- import { listPageV2 } from "@/api/auxiliaryFittings/attachmentProfile";
- import { materialNormList } from "@/api/auxiliaryPriceManagement";
- export default {
- components: { TemplatePage, ImageUpload, geographicalPosi },
- mixins: [import_mixin, operation_mixin],
- data() {
- return {
- // 表格属性
- tableAttributes: {
- // 启用勾选列
- selectColumn: false
- },
- // 表格事件
- tableEvents: {
- 'selection-change': this.selectionChange
- },
- // 勾选选中行
- recordSelected: [],
- activeName: 'items_m',
- formData: {
- companyWechatName: JSON.parse(localStorage.getItem('greemall_user')).companyName,
- projectName: "",
- projectNo: "",
- manger: "",
- mobile: "",
- startTime: "",
- endTime: "",
- provinceId: "",
- cityId: "",
- areaId: "",
- streetId: "",
- address: "",
- remark: "",
- items_m: [],
- items_p: [],
- },
- provinceList: [],
- cityList: [],
- areaList: [],
- streetList: [],
- fucaiSel: [],
- peijianSel: [],
- isEditIndex: -1,
- activeType_e: 'jbzl'
- }
- },
- computed: {
- // 更多参数
- moreParameters() {
- return []
- },
- // 事件组合
- optionsEvensGroup() {
- return [
- [
- [
- this.optionsEvensAuth('add', {
- click: () => {
- this.$refs.tabPage.addTab({
- // 对应显示的模块
- activeKey: "add",
- // 唯一标识
- key: "add",
- // 页签名称
- label: "新增",
- // 打开时事件
- triggerEvent: () => {
- this.activeType_e = 'jbzl'
- this.handleClose()
- this.$nextTick(() => {
- this.getinitlbslist()
- this.openForm()
- })
- },
- // 关闭时事件
- closeEvent: () => { }
- })
- }
- })
- ]
- ]
- ]
- },
- formItems() {
- return [
- {
- name: 'el-input',
- md: 12,
- attributes: {
- placeholder: '请输入',
- disabled: true
- },
- formItemAttributes: {
- label: '所属商户',
- prop: 'companyWechatName',
- }
- },
- {
- name: 'el-input',
- md: 12,
- attributes: {
- placeholder: '请输入'
- },
- formItemAttributes: {
- label: '工程名称',
- prop: 'projectName',
- rules: [...required],
- }
- },
- {
- name: 'el-input',
- md: 6,
- attributes: {
- placeholder: '请输入'
- },
- formItemAttributes: {
- label: '工程编号',
- prop: 'projectNo',
- rules: [...required],
- }
- },
- {
- name: 'el-input',
- md: 6,
- attributes: {
- placeholder: '请输入'
- },
- formItemAttributes: {
- label: '负责人',
- prop: 'manger',
- rules: [...required],
- }
- },
- {
- name: 'el-input',
- md: 6,
- attributes: {
- placeholder: '请输入'
- },
- formItemAttributes: {
- label: '联系电话',
- prop: 'mobile',
- rules: [...mobileRequired],
- }
- },
- {
- name: 'slot-component',
- md: 6,
- formItemAttributes: {
- label: '项目时间',
- prop: 'startTime',
- rules: [...required],
- },
- render: (h, { props }) => {
- return (
- <div style={{
- 'display': 'flex',
- 'justify-content': 'space-between'
- }}>
- <div style="width:49%">
- <el-date-picker
- style="width:100%"
- value={this.formData.startTime}
- onInput={(val) => { this.formData.startTime = val }}
- value-format="yyyy-MM-dd HH:mm:ss"
- type="datetime"
- placeholder="选择日期">
- </el-date-picker>
- </div>
- <div style="width:49%">
- <el-date-picker
- disabled={true}
- style="width:100%"
- value={this.formData.endTime}
- onInput={(val) => { this.formData.endTime = val }}
- value-format="yyyy-MM-dd HH:mm:ss"
- type="datetime"
- placeholder="选择日期">
- </el-date-picker>
- </div>
- </div>
- )
- }
- },
- {
- name: 'el-select',
- md: 6,
- formItemAttributes: {
- label: '项目地址', //省
- prop: 'provinceId',
- errLabel: '省',
- rules: [...required],
- },
- options: this.provinceList.map((v, i) => ({ value: v.id, label: v.name })),
- attributes: { disabled: false, clearable: true, filterable: true, placeholder: '请选择' },
- events: {
- change: (val) => {
- // 获取省名称
- this.formData.province = this.provinceList.find(item => item.id === val)?.name || ''
- // 清除市区街道以及详细地址数据
- this.delDataK(1)
- lbsAmapRegion({ pid: val }).then(res => {
- this.cityList = res.data
- })
- }
- }
- },
- {
- name: 'el-select',
- md: 5,
- formItemAttributes: {
- 'label-width': '0px',
- label: '', //市
- prop: 'cityId',
- errLabel: '市',
- rules: [...required],
- },
- options: this.cityList.map((v, i) => ({ value: v.id, label: v.name })),
- attributes: { disabled: false, clearable: true, filterable: true, placeholder: '请选择' },
- events: {
- change: (val) => {
- // 获取市名称
- this.formData.city = this.cityList.find(item => item.id === val).name
- // 清除区街道以及详细地址数据
- this.delDataK(2)
- lbsAmapRegion({ pid: val }).then(res => {
- this.areaList = res.data
- })
- }
- }
- },
- {
- name: 'el-select',
- md: 5,
- formItemAttributes: {
- 'label-width': '0px',
- label: '', //区
- prop: 'areaId',
- errLabel: '区',
- rules: [...required],
- },
- options: this.areaList.map((v, i) => ({ value: v.id, label: v.name })),
- attributes: { disabled: false, clearable: true, filterable: true, placeholder: '请选择' },
- events: {
- change: (val) => {
- // 获取区名称
- this.formData.area = this.areaList.find(item => item.id === val).name
- // 清除街道以及详细地址数据
- this.delDataK(3)
- lbsAmapRegion({ pid: val }).then(res => {
- this.streetList = res.data
- })
- }
- }
- },
- {
- name: 'el-select',
- md: 5,
- formItemAttributes: {
- 'label-width': '0px',
- label: '', //街道
- prop: 'streetId',
- errLabel: '街道',
- rules: [...required],
- },
- options: this.streetList.map((v, i) => ({ value: v.id, label: v.name })),
- attributes: { disabled: false, clearable: true, filterable: true, placeholder: '请选择' },
- events: {
- change: (val) => {
- // 获取街道名称
- this.formData.street = this.streetList.find(item => item.id === val).name
- // 清除详细地址数据
- this.delDataK(4)
- }
- }
- },
- {
- name: 'slot-component',
- md: 3,
- formItemAttributes: {
- 'label-width': '0px',
- prop: '',
- },
- render: (h, { props }) => {
- return (
- <geographicalPosi
- formData={this.formData}
- onSelectPosi={data => {
- // 获取经纬度
- this.formData.lng = data.center[0]
- this.formData.lat = data.center[1]
- // 获取定位的省市区街道
- var { province, city, district, township } = data.data.addressComponent
- // 获取选中省名称id
- var { id, name } = this.provinceList.find(item => item.name === province)
- this.formData.provinceId = id
- this.formData.province = name
- // 请求市选项
- lbsAmapRegion({ pid: this.formData.provinceId }).then(res => {
- // 赋值市选项
- this.cityList = res.data
- // 获取选中市名称id
- var { id, name } = res.data.find(item => item.name === city)
- this.formData.cityId = id
- this.formData.city = name
- // 请求区选项
- lbsAmapRegion({ pid: this.formData.cityId }).then(res => {
- // 赋值区选项
- this.areaList = res.data
- // 获取选中区名称id
- var { id, name } = res.data.find(item => item.name === district)
- this.formData.areaId = id
- this.formData.area = name
- // 请求街道选项
- lbsAmapRegion({ pid: this.formData.areaId }).then(res => {
- // 赋值街道选项
- this.streetList = res.data
- // 获取选中街道名称id
- var { id, name } = res.data.find(item => item.name === township)
- this.formData.streetId = id
- this.formData.street = name
- this.formData.address = data.name
- })
- })
- })
- }}
- />
- )
- }
- }, {
- name: 'el-input',
- md: 24,
- formItemAttributes: { label: '详细地址', prop: 'address', rules: [...required] },
- attributes: { placeholder: '详细地址' }
- }, {
- name: 'el-input',
- md: 24,
- attributes: {
- type: 'textarea',
- rows: 3,
- placeholder: '请输入'
- },
- formItemAttributes: {
- label: '项目说明',
- prop: 'remark',
- }
- }
- ]
- },
- formItems2() {
- return [
- {
- md: 24,
- isShow: true,
- name: 'slot-component',
- formItemAttributes: {
- label: '',
- prop: '',
- 'label-width': '0px'
- },
- render: (h, { props, onInput }) => {
- var { value } = props
- return (
- <div>
- {this.activeName == 'items_m'
- ? [
- <div style="margin-bottom:10px">
- <el-button type="primary" onClick={() => { this.addItem("M") }}>
- 添加
- </el-button>
- </div>,
- <zj-table
- columns={[
- {
- columnAttributes: {
- label: '大类',
- prop: 'parentCategoryId',
- propName: 'parentCategoryName',
- width: 160
- },
- render: (h, { row, column, index }) => {
- return this.isEditIndex == index ? (
- <div class="redbordererr">
- <el-form-item
- label=""
- lebel-width="0px"
- prop={`${this.activeName}.${index}.${column.columnAttributes.prop}`}
- rules={required}
- >
- <el-select
- filterable={true}
- value={row[column.columnAttributes.prop]}
- onInput={val => {
- row[column.columnAttributes.prop] = val
- }}
- onChange={val => {
- if (val) {
- row[column.columnAttributes.propName] = this.arrQC(this.fucaiSel, { value: 'parentCategoryId', label: 'parentCategoryName' }).find(item => item.value == val)?.label || ""
- } else {
- row[column.columnAttributes.propName] = ''
- }
- this.delItemKey(1, row)
- }}
- placeholder="请选择"
- >
- {
- this.arrQC(this.fucaiSel, { value: 'parentCategoryId', label: 'parentCategoryName' }).map((item, index_) => (
- <el-option key={index_} label={item.label} value={item.value}></el-option>
- ))
- }
- </el-select>
- </el-form-item>
- </div>
- ) : (
- <div style="padding:0 6px">{row[column.columnAttributes.propName]}</div>
- )
- }
- },
- {
- columnAttributes: {
- label: '小类',
- prop: 'goodsCategoryId',
- propName: 'goodsCategoryName',
- width: 160
- },
- render: (h, { row, column, index }) => {
- return this.isEditIndex == index ? (
- <div class="redbordererr">
- <el-form-item
- label=""
- lebel-width="0px"
- prop={`${this.activeName}.${index}.${column.columnAttributes.prop}`}
- rules={required}
- >
- <el-select
- filterable={true}
- value={row[column.columnAttributes.prop]}
- onInput={val => {
- row[column.columnAttributes.prop] = val
- }}
- onChange={val => {
- if (val) {
- row[column.columnAttributes.propName] = this.arrQC(this.fucaiSel.filter(item => item.parentCategoryId === row.parentCategoryId), { value: 'goodsCategoryId', label: 'categoryName' }).find(item => item.value == val)?.label || ""
- } else {
- row[column.columnAttributes.propName] = ''
- }
- this.delItemKey(2, row)
- }}
- placeholder="请选择"
- >
- {
- this.arrQC(this.fucaiSel.filter(item => item.parentCategoryId === row.parentCategoryId), { value: 'goodsCategoryId', label: 'categoryName' }).map((item, index_) => (
- <el-option key={index_} label={item.label} value={item.value}></el-option>
- ))
- }
- </el-select>
- </el-form-item>
- </div>
- ) : (
- <div style="padding:0 6px">{row[column.columnAttributes.propName]}</div>
- )
- }
- },
- {
- columnAttributes: {
- label: '辅材名称',
- prop: 'goodsId',
- propName: 'goodsName',
- width: 160
- },
- render: (h, { row, column, index }) => {
- return this.isEditIndex == index ? (
- <div class="redbordererr">
- <el-form-item
- label=""
- lebel-width="0px"
- prop={`${this.activeName}.${index}.${column.columnAttributes.prop}`}
- rules={required}
- >
- <el-select
- filterable={true}
- value={row[column.columnAttributes.prop]}
- onInput={val => {
- row[column.columnAttributes.prop] = val
- }}
- onChange={val => {
- this.delItemKey(3, row)
- if (val) {
- var data = this.arrQC(this.fucaiSel.filter(item => item.parentCategoryId === row.parentCategoryId && item.goodsCategoryId === row.goodsCategoryId), { value: 'goodsId', label: 'goodsName' }).find(item => item.value == val)
- row[column.columnAttributes.propName] = data?.label || ""
- if (data) {
- row.goodsCode = data?.data?.goodsCode
- row.goodsSpecification = data?.data?.goodsSpecification
- row.normType = "M"
- row.goodsStockUnit = data?.data?.goodsStockUnit
- }
- } else {
- row[column.columnAttributes.propName] = ''
- }
- }}
- placeholder="请选择"
- >
- {
- this.arrQC(this.fucaiSel.filter(item => item.parentCategoryId === row.parentCategoryId && item.goodsCategoryId === row.goodsCategoryId), { value: 'goodsId', label: 'goodsName' }).map((item, index_) => (
- <el-option key={index_} label={item.label} value={item.value}></el-option>
- ))
- }
- </el-select>
- </el-form-item>
- </div>
- ) : (
- <div style="padding:0 6px">{row[column.columnAttributes.propName]}</div>
- )
- }
- },
- {
- columnAttributes: {
- label: '商品代码',
- prop: 'goodsCode',
- width: 160
- }
- },
- {
- columnAttributes: {
- label: '规格型号',
- prop: 'goodsSpecification',
- width: 160
- }
- },
- {
- columnAttributes: {
- label: '单位',
- prop: 'goodsStockUnit',
- width: 160
- }
- },
- {
- columnAttributes: {
- label: '收费类型',
- prop: 'normType',
- width: 160
- },
- render: (h, { row, column, index }) => {
- return <div style="padding:0 6px">{({ M: '物料收费', S: '服务收费' })[row[column.columnAttributes.prop]] || ''}</div>
- }
- },
- ...this.commonColumns
- ]}
- tableData={this.formData.items_m}
- tableAttributes={{
- size: 'mini',
- border: true
- }}
- />
- ]
- : this.activeName == 'items_p'
- ? [
- <div style="margin-bottom:10px">
- <el-button type="primary" onClick={() => { this.addItem("P") }}>
- 添加
- </el-button>
- </div>,
- <zj-table
- columns={[
- {
- columnAttributes: {
- label: '配件名称',
- prop: 'goodsId',
- propName: 'goodsName',
- width: 160
- },
- render: (h, { row, column, index }) => {
- return this.isEditIndex == index ? (
- <div class="redbordererr">
- <el-form-item
- label=""
- lebel-width="0px"
- prop={`${this.activeName}.${index}.${column.columnAttributes.prop}`}
- rules={required}
- >
- <el-select
- filterable={true}
- value={row[column.columnAttributes.prop]}
- onInput={val => {
- row[column.columnAttributes.prop] = val
- }}
- onChange={val => {
- this.delItemKey(3, row)
- if (val) {
- var data = this.peijianSel.find(item => item.goodsId == val)
- row[column.columnAttributes.propName] = data?.goodsName || ""
- if (data) {
- row.goodsStockUnit = data.goodsStockUnit
- row.goodsCode = data.goodsCode
- row.normType = data.normType
- row.brandRelaName = data.brandRelaName
- row.productRelaName = data.productRelaName
- }
- } else {
- row[column.columnAttributes.propName] = ''
- }
- }}
- placeholder="请选择"
- >
- {this.peijianSel.map((item, index_) => (
- <el-option key={index_} label={item.goodsName} value={item.goodsId}></el-option>
- ))}
- </el-select>
- </el-form-item>
- </div>
- ) : (
- <div style="padding:0 6px">{row[column.columnAttributes.propName]}</div>
- )
- }
- },
- {
- columnAttributes: {
- label: '单位',
- prop: 'goodsStockUnit',
- width: 160
- }
- },
- {
- columnAttributes: {
- label: '商品代码',
- prop: 'goodsCode',
- width: 160
- }
- },
- {
- columnAttributes: {
- label: '收费类型',
- prop: 'normType',
- width: 160
- },
- render: (h, { row, column, index }) => {
- return <div style="padding:0 6px">{({ M: '物料收费', S: '服务收费' })[row[column.columnAttributes.prop]] || ''}</div>
- }
- },
- {
- columnAttributes: {
- label: '适用品牌',
- prop: 'brandRelaName',
- width: 160
- }
- },
- {
- columnAttributes: {
- label: '适用产品大类',
- prop: 'productRelaName',
- width: 160
- }
- },
- ...this.commonColumns
- ]}
- tableData={this.formData.items_p}
- tableAttributes={{
- size: 'mini',
- border: true
- }}
- />
- ]
- : null}
- </div>
- )
- }
- }
- ]
- },
- commonColumns() {
- return [{
- columnAttributes: {
- label: '销售价格(元)',
- prop: 'normAmount',
- },
- render: (h, { row, column, index }) => {
- return this.isEditIndex == index ? (
- <div class="redbordererr">
- <el-form-item
- label=""
- lebel-width="0px"
- prop={`${this.activeName}.${index}.${column.columnAttributes.prop}`}
- rules={required}
- >
- <el-input
- value={row[column.columnAttributes.prop]}
- onInput={val => {
- row[column.columnAttributes.prop] = val
- }}
- type="number"
- placeholder="请输入"
- ></el-input>
- </el-form-item>
- </div>
- ) : (
- <div style="padding:0 6px">{row[column.columnAttributes.prop]}</div>
- )
- }
- },
- // {
- // columnAttributes: {
- // label: '师傅分账金额(元)',
- // prop: 'workerAmount',
- // width: 160
- // },
- // render: (h, { row, column, index }) => {
- // return this.isEditIndex == index ? (
- // <div class="redbordererr">
- // <el-form-item
- // label=""
- // lebel-width="0px"
- // prop={`${this.activeName}.${index}.${column.columnAttributes.prop}`}
- // rules={required}
- // >
- // <el-input
- // value={row[column.columnAttributes.prop]}
- // onInput={val => {
- // row[column.columnAttributes.prop] = val
- // }}
- // type="number"
- // placeholder="请输入"
- // ></el-input>
- // </el-form-item>
- // </div>
- // ) : (
- // <div style="padding:0 6px">{row[column.columnAttributes.prop]}</div>
- // )
- // }
- // }, {
- // columnAttributes: {
- // label: '商户分账金额(元)',
- // prop: 'websitAmount',
- // width: 160
- // },
- // render: (h, { row, column, index }) => {
- // return this.isEditIndex == index ? (
- // <div class="redbordererr">
- // <el-form-item
- // label=""
- // lebel-width="0px"
- // prop={`${this.activeName}.${index}.${column.columnAttributes.prop}`}
- // rules={required}
- // >
- // <el-input
- // value={row[column.columnAttributes.prop]}
- // onInput={val => {
- // row[column.columnAttributes.prop] = val
- // }}
- // type="number"
- // placeholder="请输入"
- // ></el-input>
- // </el-form-item>
- // </div>
- // ) : (
- // <div style="padding:0 6px">{row[column.columnAttributes.prop]}</div>
- // )
- // }
- // },
- {
- columnAttributes: {
- label: '操作',
- fixed: 'right',
- width: 140
- },
- render: (h, { row, column, index }) => {
- return (
- <div style="padding:0 6px" class="operation-btns">
- {[
- this.isEditIndex == index ? (
- <el-button
- type="text"
- onClick={() => { this.verifyBtn() }}
- >
- 确认
- </el-button>
- ) : null,
- this.isEditIndex == -1 ? (
- <el-button
- type="text"
- onClick={() => { this.isEditIndex = index }}
- >
- 编辑
- </el-button>
- ) : null,
- <el-button
- type="text"
- onClick={() => {
- this.formData?.[this.activeName]?.splice(index, 1)
- if (index == this.isEditIndex) {
- this.isEditIndex = -1
- }
- }}
- >
- 删除
- </el-button>
- ]}
- </div>
- )
- }
- }]
- },
- logList() {
- return [
- {
- md: 24,
- isShow: true,
- name: 'slot-component',
- formItemAttributes: {
- label: '',
- prop: '',
- 'label-width': '0px'
- },
- render: (h, { props, onInput }) => {
- var { value } = props
- return (
- <zj-table
- columns={[
- {
- columnAttributes: {
- label: '操作类型',
- prop: 'typeText',
- }
- },
- {
- columnAttributes: {
- label: '操作内容',
- prop: 'content',
- }
- },
- {
- columnAttributes: {
- label: '操作人',
- prop: 'createBy',
- }
- },
- {
- columnAttributes: {
- label: '操作时间',
- prop: 'createTime',
- }
- },
- ]}
- tableData={this.formData.operatorLogList}
- tableAttributes={{
- size: 'mini',
- border: true
- }}
- />
- )
- }
- }
- ]
- },
- },
- methods: {
- // 列表请求函数
- getList: orderEnginbaseList,
- // 列表导出函数
- exportList: orderEnginBaseListExport,
- // 表格列解析渲染数据更改
- columnParsing(item, defaultData) {
- return defaultData
- },
- // 监听勾选变化
- selectionChange(data) {
- this.recordSelected = data
- },
- handleClose() {
- this.$refs?.formRef?.resetFields()
- this.$data.formData = this.$options.data().formData
- this.activeName = 'items_m'
- },
- // 打开弹窗
- openForm() {
- this.isEditIndex = -1
- // 获取辅材下拉数据
- materialNormList({ "pageNum": 1, "pageSize": -1, "params": [{ "param": "a.status", "compare": "=", "value": "ON" }] }).then(res => {
- this.fucaiSel = res.data.records
- });
- // 获取配件下拉数据
- listPageV2({ "pageNum": 1, "pageSize": -1, "params": [{ "param": "a.status", "compare": "=", "value": "ON" }, { "param": "a.norm_type", "compare": "=", "value": "M" }] }).then(res => {
- this.peijianSel = res.data.records
- });
- },
- quedingbaocun(removeTab) {
- this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
- if (valid) {
- orderEnginBaseSave({
- ...this.formData,
- items: [...this.formData.items_m, ...this.formData.items_p]
- }).then(res => {
- this.$message({
- type: 'success',
- message: '保存成功'
- })
- this.handleClose()
- this.$refs.pageRef.refreshList()
- removeTab && removeTab()
- })
- }
- })
- },
- // 操作按钮
- operation() {
- return this.operationBtn({
- detail: {
- click: ({ row, index, column }) => {
- this.$refs.tabPage.addTab({
- // 对应显示的模块
- activeKey: "detail",
- // 唯一标识
- key: "detail",
- // 页签名称
- label: "详情",
- // 打开时事件
- triggerEvent: () => {
- this.activeType_e = 'jbzl'
- this.handleClose()
- this.$nextTick(() => {
- orderEnginBaseDetail({ id: row.id }).then(res => {
- Object.assign(this.formData, res.data, {
- items_m: (res.data.items || []).filter(item => item.goodsType == "M"),
- items_p: (res.data.items || []).filter(item => item.goodsType == "P"),
- })
- this.getinitlbslist()
- this.openForm()
- })
- })
- },
- // 关闭时事件
- closeEvent: () => { }
- })
- }
- },
- orderDetail: {
- click: ({ row, index, column }) => {
- this.$router.push({
- name: 'workOrderPool',
- params: {
- pageName: row.projectNo,
- pageType: 'projectNo',
- pageCode: row.projectNo,
- },
- })
- }
- }
- })
- },
- // 获取省市区街道
- getinitlbslist() {
- // 初始化请求省市区街道下拉选项数据
- lbsAmapRegion({ pid: 0 }).then(res => {
- this.provinceList = res.data
- if (this.formData.provinceId) {
- var item = this.provinceList.find(item => item.name === this.formData.provinceId)
- if (item) {
- this.formData.province = item.name
- }
- lbsAmapRegion({ pid: this.formData.provinceId }).then(res => {
- this.cityList = res.data
- if (this.formData.cityId) {
- var item2 = this.cityList.find(item => item.name === this.formData.cityId)
- if (item2) {
- this.formData.city = item2.name
- }
- lbsAmapRegion({ pid: this.formData.cityId }).then(res => {
- this.areaList = res.data
- if (this.formData.areaId) {
- var item3 = this.areaList.find(item => item.name === this.formData.areaId)
- if (item3) {
- this.formData.city = item2.name
- }
- lbsAmapRegion({ pid: this.formData.areaId }).then(res => {
- this.streetList = res.data
- if (this.formData.streetId) {
- var item4 = this.streetList.find(item => item.name === this.formData.streetId)
- if (item4) {
- this.formData.street = item4.name
- }
- }
- })
- }
- })
- }
- })
- }
- })
- },
- delDataK(num) {
- if (num <= 1) {
- // 删除市
- this.formData.cityId = ''
- this.formData.city = ''
- // 删除市选项
- this.cityList = []
- }
- if (num <= 2) {
- // 删除区
- this.formData.areaId = ''
- this.formData.area = ''
- // 删除区选项
- this.areaList = []
- }
- if (num <= 3) {
- // 删除街道
- this.formData.streetId = ''
- this.formData.street = ''
- // 删除街道选项
- this.streetList = []
- }
- // 删除gps地址
- this.formData.address = ''
- },
- delItemKey(num, row) {
- if (num <= 1) {
- row.goodsCategoryId = ""
- row.goodsCategoryName = ""
- }
- if (num <= 2) {
- row.goodsId = ""
- row.goodsName = ""
- }
- if (num <= 3) {
- row.brandRelaId = ""
- row.brandRelaName = ""
- row.goodsBarcodeId = ""
- row.goodsCode = ""
- row.goodsSpecification = ""
- row.goodsStockUnit = ""
- row.normType = ""
- row.orderEnginBaseId = ""
- row.productCreateBy = ""
- row.productCreateTime = ""
- row.productRelaId = ""
- row.productRelaName = ""
- row.productUpdateBy = ""
- row.productUpdateTime = ""
- }
- },
- arrQC(list, qz = { label: '', value: '' }) {
- var obj = {}
- for (var item of list) {
- obj[item[qz?.value || 'value']] = item
- }
- return Object.keys(obj).map(key => {
- return {
- data: obj[key],
- value: key,
- label: obj[key][qz?.label || 'label']
- }
- })
- },
- addItem(goodsType) {
- if (this.isEditIndex > -1) {
- this.$refs.formRef.validateField(this.getVfyKey(this.isEditIndex), (valid, invalidFields, errLabels) => {
- if (valid) {
- this.formData[this.activeName].unshift({
- "brandRelaId": "",
- "brandRelaName": "",
- "goodsBarcodeId": "",
- "goodsCategoryId": "",
- "goodsCategoryName": "",
- "goodsCode": "",
- "goodsId": "",
- "goodsName": "",
- "goodsSpecification": "",
- "goodsStockUnit": "",
- "goodsType": goodsType,
- "normAmount": '',
- "normType": "",
- "orderEnginBaseId": "",
- "parentCategoryId": "",
- "parentCategoryName": "",
- "productCreateBy": "",
- "productCreateTime": "",
- "productRelaId": "",
- "productRelaName": "",
- "productUpdateBy": "",
- "productUpdateTime": "",
- // "websitAmount": '',
- // "workerAmount": ''
- })
- this.isEditIndex = 0
- }
- })
- } else {
- this.formData[this.activeName].unshift({
- "brandRelaId": "",
- "brandRelaName": "",
- "goodsBarcodeId": "",
- "goodsCategoryId": "",
- "goodsCategoryName": "",
- "goodsCode": "",
- "goodsId": "",
- "goodsName": "",
- "goodsSpecification": "",
- "goodsStockUnit": "",
- "goodsType": goodsType,
- "normAmount": '',
- "normType": "",
- "orderEnginBaseId": "",
- "parentCategoryId": "",
- "parentCategoryName": "",
- "productCreateBy": "",
- "productCreateTime": "",
- "productRelaId": "",
- "productRelaName": "",
- "productUpdateBy": "",
- "productUpdateTime": "",
- // "websitAmount": '',
- // "workerAmount": ''
- })
- this.isEditIndex = 0
- }
- },
- getVfyKey() {
- return [
- `${this.activeName}.${this.isEditIndex}.parentCategoryId`,
- `${this.activeName}.${this.isEditIndex}.goodsCategoryId`,
- `${this.activeName}.${this.isEditIndex}.goodsId`,
- `${this.activeName}.${this.isEditIndex}.normAmount`,
- // `${this.activeName}.${this.isEditIndex}.workerAmount`,
- // `${this.activeName}.${this.isEditIndex}.websitAmount`,
- ]
- },
- verifyBtn() {
- this.$refs.formRef.validateField(this.getVfyKey(this.isEditIndex), (valid, invalidFields, errLabels) => {
- if (valid) {
- this.isEditIndex = -1
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped></style>
|